$ sed -i 18d .ssh/known_hosts

Jan. 16, 2013, 2:29 p.m.EvaggelosBalaskas


Using sed to remove a specific line.

The -i parameter is to edit the file in-place.


This works as posted in GNU sed. In BSD sed, the -i flag requires a parameter to use as the suffix of a backup file. You can set it to empty to not use a backup file:

sed -i'' 18d .ssh/known_hosts