Using SED command line to delete line from a file.

d Delete pattern space. Start next cycle.

You can use the following one liner to remove one line (line 3) from a file.

$ sed -i 3d ~/.ssh/known_hosts

This will remove line 3 form the file ~/.ssh/known_hosts

Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.