Deleting a line from a file

Valdis.Kletnieks at vt.edu Valdis.Kletnieks at vt.edu
Wed May 14 11:18:21 EDT 2014


On Wed, 14 May 2014 16:34:20 +0200, Bernd Petrovitsch said:

> sed -i 's#^/opt/new1.*$#d' file_entries.txt

You don't even need the leading 's'.   Just   /pattern/d   is sufficient.

(And you can even do stuff like   /pat1/,/pat2/s/old/new/   which will
change 'old' to 'new', but only from a line that contains pat1 up to a
line that contains pat2, and *not* changing it before pat1 or after pat2....)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140514/38c244d1/attachment.bin 


More information about the Kernelnewbies mailing list