Revision: 6214
Updated Code
at May 8, 2008 21:40 by Juanje
Updated Code
# delete the line 18 from '~/.ssh/known_hosts' file sed -i '18 d' ~/.ssh/known_hosts # also sed -i 18d ~/.ssh/known_hosts # delete few lines # delete 6 lines from line 8 sed -i 8,+6d file.txt # delete the line where is 'TO DELETE' sed -i '/TO DELETE/ d' file.txt
Revision: 6213
Updated Code
at May 8, 2008 19:35 by Juanje
Updated Code
# delete the line 18 from '~/.ssh/known_hosts' file sed -i '18 d' ~/.ssh/known_hosts # delete the line where is 'TO DELETE' sed -i '/TO DELETE/ d' file.txt
Revision: 6212
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 8, 2008 19:22 by Juanje
Initial Code
# delete the line 18 from '~/.ssh/known_hosts' file sed -i '18 d' ~/.ssh/known_hosts
Initial URL
Initial Description
For deleting a line from a file without open the file you can use sed. For example, it has been very useful many times for me after anoying messages from ssh when a host I use to connect change the IP... And sometimes you don't know the line number but you know a specific word from this line.
Initial Title
Delete specific line from a file with sed
Initial Tags
Initial Language
Bash