how de delete a ligne from a file

Dave Cross davorg at gmail.com
Wed Jun 10 15:29:59 UTC 2009


2009/6/10 Chad Kellerman <sunckell at gmail.com>:
> pe
>
> On Wed, Jun 10, 2009 at 10:35 AM, Adel ESSAFI <adelessafi at gmail.com> wrote:
>>
>> Hi list
>>
>> Is there a method to delete a line from a file withoout editing it!
>
> you can use perl
>
> perl -p -i -e `s/Line in file you want to remove//' filename

That removes the data, but leaves an empty line in its place. To
actually remove the line you need something more like:

perl -n -i~ -e 'print unless /Line in file you want to remove/' filename

I've also given the -i option a value so that you get a backup file.

hth,

Dave...




More information about the fedora-list mailing list