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

Re: how de delete a ligne from a file



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 padep org bo
> otbits.blogspot.com / counter.li.org: #367962
> ----------------------------------------------
> "Träume nicht dein Leben, lebe deinen Traum."
> - Unbekannter Autor
> 


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