Re: Deleting a line from one place and inserting it in another place

2011-07-19 Thread Shlomi Fish
Hello Melvin, next time please hit "Reply to all", because this message was sent only to me in private. I specifically request that in my signature: [QUOTE] > > > > Please reply to list if it's a mailing list post - http://shlom.in/reply . > > [QUOTE] Since you have not specified that this was s

Re: Deleting a line from one place and inserting it in another place

2011-07-17 Thread Shlomi Fish
Hi Melvin, On Fri, 15 Jul 2011 01:23:10 -0700 (PDT) Melvin wrote: > Hi All, > > I am a newbie to Perl. I wanted to write a below utility:- > > 1) Read a list of file names (from another file) > 2) Search for String1 (this is an entire line in the file names > obtained from the list) > 3) "gvi

Re: Deleting a line that contains certain text

2003-09-08 Thread Scott R. Godin
David Wall wrote: > > > --On Saturday, September 06, 2003 7:45 PM -0400 perlwannabe > <[EMAIL PROTECTED]> wrote: > >> OK, I have a new problem. I need to delete an entire line that contains >> certain text. I have done an extensive search and had no luck finding an >> adequate answer. Yes, I

Re: Deleting a line that contains certain text

2003-09-07 Thread John W. Krahn
"R. Joseph Newton" wrote: > > "John W. Krahn" wrote: > > > > rename $file, "$file.bak" or die "Cannot move $file to $file.bak: $!"; > > I would say that this is the wrong place for the rename. Computers do crash. > If a crash occurs while this program is in progress, then he is left with a > re

Re: Deleting a line that contains certain text

2003-09-07 Thread R. Joseph Newton
"John W. Krahn" wrote: > > Also, I would like to run this from within a script instead of from the > > command line. > > > > BTW...using PERL 5.8.0 on Windows2000 Pro > > Here is one way to do it: > > use warnings; > use strict; > > my $file = shift or die "usage: $0 filename\n"; > > rename $file,

Re: Deleting a line that contains certain text

2003-09-06 Thread John W. Krahn
Perlwannabe wrote: > > OK, I have a new problem. I need to delete an entire line that contains > certain text. I have done an extensive search and had no luck finding an > adequate answer. Yes, I also saw the FAQ that just refers me to > Tie::file. The most promising solution was: > > perl -n

Re: Deleting a line that contains certain text

2003-09-06 Thread David Wall
--On Saturday, September 06, 2003 7:45 PM -0400 perlwannabe <[EMAIL PROTECTED]> wrote: OK, I have a new problem. I need to delete an entire line that contains certain text. I have done an extensive search and had no luck finding an adequate answer. Yes, I also saw the FAQ that just refers me

Re: Deleting a line

2001-12-07 Thread Scott R. Godin
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Mark McLogan) wrote: > Hi every body! > I don't know how i can delete a line of a file. > > Some body know? > > Thnk's perldoc -q delete print pack "H*", "4a75737420416e6f74686572204d61635065726c204861636b65722c0d"; -- Scott R. Godin

RE: Deleting a line

2001-12-07 Thread Wagner-David
Depending on what you are after, there is a number of ways from one-liners to whatever. In most basic form, you will need to open file to read, another file to write. Using the regex or some type of test to determine if a line is to be re-written to the file or not.

Re: deleting a line with a particular string.

2001-06-28 Thread Me
> I have a file having 100 lines. > I want to remove the lines, having a particular string, completely from the > file. (notreplacing them with blank lines even) > > Is there a way in perl for doing this ? At a shell prompt / command line, enter: perl -ne '/string/ or print' file where stri

RE: deleting a line with a particular string.

2001-06-28 Thread John Edwards
$original = "c:\\myfile.txt"; $changed = "c:\\mynewfile.txt"; $searchfor = "john"; # Text identifying line(s) you want removing open IN, $original or die "Can't open $original: $!"; open OUT, ">$changed" or die "Can't create $changed: $!"; while() { print OUT unless /$changed/; } close

RE: deleting a line with a particular string.

2001-06-28 Thread Ronald J. Yacketta
> I have a file having 100 lines. > I want to remove the lines, having a particular string, > completely from the > file. (not replacing them with blank lines even) > > Is there a way in perl for doing this ? most defiantly, tho I am a novice at perl right now. I have sent this to the beginner