Re: Deleting a line from a file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mit, 2014-05-14 at 11:18 -0400, Valdis.Kletnieks@xxxxxx wrote:
> 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.

Ooops, yes, thanks. So

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). But we need /../,
so just quote the "/" in the path.
The "d" tells "sed" to delete the current line.

	Bernd
-- 
Bernd Petrovitsch                  Email : bernd@xxxxxxxxxxxxxxxxxxx
                     LUGA : http://www.luga.at


_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux