removing line from a file

2004-12-02 Thread Chandu B S
hi experts I want to delete a line in a file depending on the content of line, if my file is like this ccc d eee ee perl hh Here i want to remove the 4th line because it contains word perl !! ( of course i like

Re: removing line from a file

2004-12-02 Thread Edward WIJAYA
On Thu, 2 Dec 2004 21:45:28 +0530, Chandu B S [EMAIL PROTECTED] wrote: hi experts I am no experts, but I guess: but i don't want to use 2 file , can i do this within the original file Yeah just use FD only open FD , /home/file1 or die Can't open file1 file : $!; while(FD) { print FD

Re: removing line from a file

2004-12-02 Thread Jonathan Paton
Hi, Edward: Your script doesn't work, as you are only opening the file in read mode. Read/write doesn't do want you want either. If you want a quick'n'easy one liner, then use -i: -i[extension] edit files in place (makes backup if extension supplied) Your one liner would look like: perl

Re: removing line from a file

2004-12-02 Thread Edward WIJAYA
Hi, Edward: Your script doesn't work, as you are only opening the file in read mode. Read/write doesn't do want you want either. {Blushes} Thanks for the correction Jon. If you want a quick'n'easy one liner, then use -i: -i[extension] edit files in place (makes backup if extension

Re: removing line from a file

2004-12-02 Thread Jonathan Paton
PS: The Perl Cookbook (May 1999 edition) describes all three of the techniques properly in recipe 7.8, 7.9 and 7.10. I recommend the cookbook if you don't already have it. Jonathan Paton -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: removing line from a file

2004-12-02 Thread John W. Krahn
Chandu B S wrote: hi experts Hello, I want to delete a line in a file depending on the content of line, if my file is like this ccc d eee ee perl hh Here i want to remove the 4th line because it contains word perl !! (