Deleting a line from a file
Valdis.Kletnieks at vt.edu
Valdis.Kletnieks at vt.edu
Thu May 15 04:06:49 EDT 2014
On Thu, 15 May 2014 09:55:52 +0200, Bernd Petrovitsch said:
> sed -i '/\/opt\/new1/d' file_entries.txt
>
> should do it.
> Just for the match, we do not need, the tailing ".*$" (because it
> matches always).
Actually, you want to use /^\/opt\/new1[ \t]/d because otherwise it will
also delete lines that contain /usr/opt/new1 and /opt/new12.
So you want a pattern that matches ^ anchor at start, the actual
/opt/new1 pathname, and then either a blank or tab whitespace....
-------------- 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/20140515/2137e5e3/attachment.bin
More information about the Kernelnewbies
mailing list