how de delete a ligne from a file

Shawn Lower Shawn.Lower at redhat.com
Wed Jun 10 15:10:50 UTC 2009


NoSpaze wrote:
> Am Mittwoch, den 10.06.2009, 16:35 +0200 schrieb Adel ESSAFI:
>> Hi list
>> Is there a method to delete a line from a file withoout editing it!
>> I have found how to do this with awk, but it is heavy!!
> 
> sed -i '/regex/d' file

Or by number:

sed -i '2d' file

In the above example, 2 is the line number to remove.

> regex is a regular expression. For example, deleting the lines that end
> with "goodbye...":
> 
> sed -i '/goodbye\.\.\.$/d' file
> 
> :)
> ----------------------------------------------
> Rodolfo Alcazar - rodolfo.alcazar at padep.org.bo
> otbits.blogspot.com / counter.li.org: #367962
> ----------------------------------------------
> "Träume nicht dein Leben, lebe deinen Traum."
> - Unbekannter Autor
> 




More information about the fedora-list mailing list