Search Replace

2003-02-03 Thread Paul Kraus
I have an array that I want to remove every instance of '$' and all leading and trailing white space. My code only seems to remove '$'. I know I can split this into separate commands but is there a way to do this all at once? $_=~s/($\s+)||(\s+^)||(\$)//g foreach (@fields); I have also tried $_=~s

SEARCH & REPLACE

2004-05-05 Thread Madhu Reddy
-replace.pl--- #!/bin/perl -w # INPUT STRING my $in_str = ".import "; # REPLACE STRING my $repl = "/home/madhu/apps/toll.txt"; $_=$in_str; # I don't want to use following, because # "TOLL_FREE" will be changed each time #s//$repl/; # FOLLOWING WILL NOT WORK #s/_IFILE>

search replace

2003-09-06 Thread Pandey Rajeev-A19514
Hi , How do I search replace text in a file from a perl script. i.e. by opening the file in write mode and then do a search replace. I don't want to do a command line search replace. Regards Rajeev -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Search & Replace

2001-12-18 Thread RNOORY
Hi, I am used to work with a search and replace software and I have a list of pattern like the one above which I would like to translate to PERL. Need your help and comments. [Search /ix](control of the car) +[A-Za-z]_NN/2 +[A-Za-z]_IN +[A-Za-z]_AT +[A-Za-z]_NN [Replace] %1 %2 %3 %4 Reg

Re: Search Replace

2003-02-03 Thread Frank Wiles
.--[ Paul Kraus wrote (2003/02/03 at 10:29:14) ]-- | | I have an array that I want to remove every instance of '$' and all | leading and trailing white space. | My code only seems to remove '$'. I know I can split this into separate | commands but is there a way to do this all at

Re: Search Replace

2003-02-03 Thread Rob Dixon
"Paul Kraus" <[EMAIL PROTECTED]> wrote in message 005b01c2cb99$02315ee0$8afea8c0@pkraus">news:005b01c2cb99$02315ee0$8afea8c0@pkraus... > I have an array that I want to remove every instance of '$' and all > leading and trailing white space. > My code only seems to remove '$'. I know I can split th

RE: Search Replace

2003-02-03 Thread Paul Kraus
sage- From: Rob Dixon [mailto:[EMAIL PROTECTED]] Sent: Monday, February 03, 2003 10:54 AM To: [EMAIL PROTECTED] Subject: Re: Search Replace "Paul Kraus" <[EMAIL PROTECTED]> wrote in message 005b01c2cb99$02315ee0$8afea8c0@pkraus">news:005b01c2cb99$02315ee0$8afea8c0@p

Re: Search Replace

2003-02-03 Thread Rob Dixon
"Paul Kraus" <[EMAIL PROTECTED]> wrote in message 007001c2cba0$2a952ae0$8afea8c0@pkraus">news:007001c2cba0$2a952ae0$8afea8c0@pkraus... > Nope I wish. > > 3 fields. 1 is a part number, 2 is cost, 3 is list. > I am removing the '$' for 2 and 3. where as I am removing white space > from 1,2,&3. > I w

Re: Search Replace

2003-02-04 Thread Janek Schleicher
On Mon, 03 Feb 2003 10:29:14 -0500, Paul Kraus wrote: > I have an array that I want to remove every instance of '$' and all > leading and trailing white space. > My code only seems to remove '$'. I know I can split this into separate > commands but is there a way to do this all at once? Erm, I do

Re: SEARCH & REPLACE

2004-05-05 Thread James Edward Gray II
On May 5, 2004, at 11:03 AM, Madhu Reddy wrote: -replace.pl--- #!/bin/perl -w # INPUT STRING my $in_str = ".import "; # REPLACE STRING my $repl = "/home/madhu/apps/toll.txt"; $_=$in_str; Why do this? # I don't want to use following, because # "TOLL_FREE" will be changed each tim

Re: SEARCH & REPLACE

2004-05-05 Thread Madhu Reddy
--- James Edward Gray II <[EMAIL PROTECTED]> wrote: > On May 5, 2004, at 11:03 AM, Madhu Reddy wrote: > > > -replace.pl--- > > #!/bin/perl -w > > > > # INPUT STRING > > my $in_str = ".import "; > > > > # REPLACE STRING > > my $repl = "/home/madhu/apps/toll.txt"; > > > > $_=$in

Re: SEARCH & REPLACE

2004-05-05 Thread James Edward Gray II
On May 5, 2004, at 12:26 PM, Madhu Reddy wrote: following is my main script, to simulate that i assigned to $_. Thanks for your solution if (!(open(FH_SRC_SCRIPT, "$src_script"))) { close(FH_SRC_SCRIPT); return 0; } Yuck. What does that say? If we ca

Re: SEARCH & REPLACE

2004-05-05 Thread Madhu Reddy
James, Thanks for correction.. for u r question regarding file open, following is correct code if (!(open(FH_SRC_SCRIPT, $src_script))) { print "(TERADATA.pl) generate_script:: File $src_script open failed --> $!\n"; return 0; } if (!(ope

Re: SEARCH & REPLACE

2004-05-05 Thread James Edward Gray II
On May 5, 2004, at 12:44 PM, Madhu Reddy wrote: James, Thanks for correction.. for u r question regarding file open, following is correct code if (!(open(FH_SRC_SCRIPT, $src_script))) { print "(TERADATA.pl) generate_script:: File $src_script open failed --> $!\n";

Re: SEARCH & REPLACE

2004-05-05 Thread James Edward Gray II
On May 5, 2004, at 2:11 PM, Madhu Reddy wrote: Then code which i sent is inside subroutine.. Then at least drop all those crazy symbols: unless (open FH_SRC_SCRIPT $src_script) { print "Whatever"; return 0; } Isn't that easier on the eyes? James -- To unsubscribe, e-mail: [EMAIL PRO

Re: search replace

2003-09-06 Thread perlwannabe
> Hi , > > How do I search replace text in a file from a perl script. i.e. by > opening the file in write mode and then do a search replace. > > I don't want to do a command line search replace. Use the s/// operator...as follows: $_ =~ s/oldtext/newtext/gi; this will rep

Re: search replace

2003-09-06 Thread Steve
perldoc perlre perldoc -f open On Sat, 2003-09-06 at 11:53, Pandey Rajeev-A19514 wrote: > Hi , > > How do I search replace text in a file from a perl script. i.e. by opening the file > in write mode and then do a search replace. > > I don't want to do a comm

Re: search replace

2003-09-06 Thread Damon Davison
On Saturday 06 September 2003 17:53, Pandey Rajeev-A19514 wrote : : How do I search replace text in a file from a perl script. : i.e. by opening the file in write mode and then do a search : replace. You can do what you want via the regular expression substitution operator "s///" i

Search & Replace Issue

2002-04-09 Thread Kristin A. I.
I am trying to indent a scroll-thru menu which has been made into a tree using the following database query: select dept_id, LPAD(' ',2*(Level-1))||dept_name dept_name from depts start with dept_id = 1 connect by dept_parent = PRIOR dept_id; My problem is that the query uses spaces to ind

Re: Search & Replace

2001-12-18 Thread Jonathan E. Paton
> Hi, > > I am used to work with a search and replace software > and I have a list of pattern like the one above which > I would like to translate to PERL. Need your help and > comments. > There is an example above? I'm assuming your Austrailian, since that'd mean you'd be upside down compare

HOT: Search/Replace || and *|

2004-04-02 Thread LoneWolf
I have a file that I need to replace the *| and || with just | and can not seem to get it to go. It either puts in an | every space, or it puts in multiples of them, how do I fix this? here's what I have: sub cleanup{ use strict; my $file = "/home/web/sales/info/test/custs1"; my $newfile = "/ho

RE: Search & Replace Issue

2002-04-09 Thread Hanson, Robert
return $line; } Rob -Original Message- From: Kristin A. I. [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 09, 2002 12:39 PM To: [EMAIL PROTECTED] Subject: Search & Replace Issue I am trying to indent a scroll-thru menu which has been made into a tree using the following datab

Re: Search & Replace Issue

2002-04-09 Thread bob ackerman
On Tuesday, April 9, 2002, at 09:39 AM, Kristin A. I. wrote: > I am trying to indent a scroll-thru menu which has been made into a tree > using the following database query: > select dept_id, LPAD(' ',2*(Level-1))||dept_name dept_name > from depts > start with dept_id = 1 > connect by

Re: Search & Replace Issue

2002-04-09 Thread John W. Krahn
"Kristin A. I." wrote: > > I am trying to indent a scroll-thru menu which has been made > into a tree using the following database query: > select dept_id, LPAD(' ',2*(Level-1))||dept_name dept_name > from depts > start with dept_id = 1 > connect by dept_parent = PRIOR dept_id; > My probl

Search --> Replace on Unix

2001-09-06 Thread David Gilden
Hello, What is the best way do to search and replace operation on a whole directory on a UNIX box? Sed? Awk? Perl? I know this is wrong, what I want to do is a search and replace, find '../forum_idx.pl' and replace with '../forum_idx.pl' I have to hit a whole directory with this change, (and

regex search/replace syntax

2005-11-04 Thread Gary Stainburn
Hi folks I've got the following code which generates Parse error: parse error in /home/httpd/html/consumables.html on line 290 when I try to run it. The script doesn't run because of the parse error $orderSQL=~s/TOTAL/$or_total/; $orderSQL is a string containing a number of SQL statements

Search Replace in multiple files

2004-02-06 Thread chetak.sasalu
Hi, I have to search and replace 'foo' to 'bar' in all the files in a directory(has subdirectories). The files are about 40k in size. On the command line I would do it as, find ./mydir/ -type f -print | xargs perl -pi -e 's/foo/bar/' No backup of the original files required.I am brave. What i

Re: HOT: Search/Replace || and *|

2004-04-02 Thread Smoot Carl-Mitchell
On Fri, 2 Apr 2004 15:19:13 -0800 (PST) LoneWolf <[EMAIL PROTECTED]> wrote: > I have a file that I need to replace the *| and || with just | and can > not seem to get it to go. It either puts in an | every space, or it > puts in multiples of them, how do I fix this? > > here's what I have: The

Re: HOT: Search/Replace || and *|

2004-04-02 Thread John W. Krahn
Lonewolf wrote: > > I have a file that I need to replace the *| and || with just | and can not > seem to get it to go. It either puts in an | every space, or it puts in > multiples of them, how do I fix this? > > here's what I have: > sub cleanup{ > > use strict; > > my $file = "/home/web/sale

Re: Search --> Replace on Unix

2001-09-06 Thread brian d foy
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (David Gilden) wrote: > perl -e 'foreach $file (glob("*")) {grep '../forum_idx.pl' >'../cgi-bin/forum_idx.pl');}' you just want to go through each file and replace those instances? perl -pi.old -e "s|../forum_idx.pl|../cgi-bin/forum_idx.pl

Re: Search --> Replace on Unix

2001-09-06 Thread John W. Krahn
Brian D Foy wrote: > > In article <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] (David Gilden) wrote: > > > perl -e 'foreach $file (glob("*")) {grep '../forum_idx.pl' >'../cgi-bin/forum_idx.pl');}' > > you just want to go through each file and replace those instances? > > perl -pi.old -e "s|..

Re: Search --> Replace on Unix

2001-09-12 Thread lc-brian_d_foy
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (John W. Krahn) wrote: > brian d foy wrote: > > In article <[EMAIL PROTECTED]>, > > [EMAIL PROTECTED] (David Gilden) wrote: > > > perl -e 'foreach $file (glob("*")) {grep '../forum_idx.pl' >'../cgi-bin/forum_idx.pl');}' > > perl -pi.old -

search replace one liner problem

2007-09-17 Thread jrpfinch
I would like to execute the following regex on a file: s/(\$Revision:\s+)(\d+\.\d+)(\s+\$.+use constant VERSION\s+=> ")(.+?) (")/$1$2$3Revision $2$5/gs I am doing this in bash as follows: REGEX='s/(\$Revision:\s+)(\d+\.\d+)(\s+\$.+use constant VERSION\s+=> ") (.+?)(")/$1$2$3Revision $2$5/gs' REG

WhiteSpace - Map, search replace, split

2005-04-20 Thread Paul Kraus
Why does this work my $date = 'one | two |three |'; my @record = map ( whitespace($_), (split /\|/,$_) ); sub whitespace { my $string = shift; $string =~ s/^\s+|\s+$//g; return $string; } but this does not my @record = map ( $_=~ s/^\s+|\s+$//g,(split /\|/,$_) ); Paul --

Re: regex search/replace syntax

2005-11-04 Thread Gary Stainburn
On Friday 04 November 2005 12:03 pm, Gary Stainburn wrote: [snip] > $orderSQL is a string containing a number of SQL statements with the > placeholder &total; and $or_total has a value of '695.76' > Sorry, the placeholder is TOTAL not &total. I changed it to see if it made a difference, which it

Re: regex search/replace syntax

2005-11-04 Thread Xavier Noria
On Nov 4, 2005, at 13:03, Gary Stainburn wrote: Hi folks I've got the following code which generates Parse error: parse error in /home/httpd/html/consumables.html on line 290 when I try to run it. The script doesn't run because of the parse error $orderSQL=~s/TOTAL/$or_total/; $orderS

Re: regex search/replace syntax

2005-11-04 Thread Gary Stainburn
On Friday 04 November 2005 12:20 pm, Xavier Noria wrote: > On Nov 4, 2005, at 13:03, Gary Stainburn wrote: > > Hi folks I've got the following code which generates > > > > Parse error: parse error in /home/httpd/html/consumables.html on > > line 290 > > > > when I try to run it. The script doesn't

Re: regex search/replace syntax

2005-11-04 Thread Xavier Noria
On Nov 4, 2005, at 13:58, Gary Stainburn wrote: On Friday 04 November 2005 12:20 pm, Xavier Noria wrote: On Nov 4, 2005, at 13:03, Gary Stainburn wrote: Hi folks I've got the following code which generates Parse error: parse error in /home/httpd/html/consumables.html on line 290 when I try

Re: regex search/replace syntax

2005-11-04 Thread John W. Krahn
Gary Stainburn wrote: > Hi folks I've got the following code which generates > > Parse error: parse error in /home/httpd/html/consumables.html on line > 290 That message did not come from perl. perldoc perldiag > when I try to run it. The script doesn't run because of the parse error > >

Re: Search Replace in multiple files

2004-02-06 Thread Jan Eden
[EMAIL PROTECTED] wrote: >Hi, > >I have to search and replace 'foo' to 'bar' in all the files in a >directory(has subdirectories). The files are about 40k in size. > >What is the most efficient way to implement this inside a perl >program ? There are about 30 files to be processed. I went through

Re: Search Replace in multiple files

2004-02-06 Thread Jan Eden
Please disregard my post, I mixed up the magic <> and the less magic . -- These are my principles and if you don't like them... well, I have others. - Groucho Marx -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Search Replace in multiple files

2004-02-06 Thread Rob Dixon
Chetak Sasalu wrote: > > I have to search and replace 'foo' to 'bar' in all the files in a > directory(has subdirectories). > The files are about 40k in size. > > On the command line I would do it as, > find ./mydir/ -type f -print | xargs perl -pi -e 's/foo/bar/' > > No backup of the original fil

Re: Search Replace in multiple files

2004-02-06 Thread Randy W. Sims
On 02/06/04 07:45, [EMAIL PROTECTED] wrote: PS: I see this term 'foo' 'bar' in many programming books, what is the etymology of this? It is derived from a technical acronym FUBAR - [EMAIL PROTECTED] Up Beyond All Repair (or Recognition). 'foo', 'bar' is just a play on the original acronym - A jo

RE: Search Replace in multiple files

2004-02-06 Thread Charles K. Clarkson
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: : : I went through perldoc perlrun and saw the code. : : I thought it as a criminal waste of time to try and : modify that code for my purpose, when I can ask you : folks :-) Perhaps I am misunderstanding you, but that sounds to me like you would

RE: Search Replace in multiple files

2004-02-06 Thread Ned Cunningham
les K. Clarkson [mailto:[EMAIL PROTECTED] Sent: Friday, February 06, 2004 9:54 AM To: [EMAIL PROTECTED] Subject: RE: Search Replace in multiple files [EMAIL PROTECTED] <[EMAIL PROTECTED

Re: Search Replace in multiple files

2004-02-06 Thread John W. Krahn
Chetak Sasalu wrote: > > Hi, Hello, > I have to search and replace 'foo' to 'bar' in all the files in a > directory(has subdirectories). > The files are about 40k in size. > > On the command line I would do it as, > find ./mydir/ -type f -print | xargs perl -pi -e 's/foo/bar/' > > No backup o

Re: Search Replace in multiple files

2004-02-06 Thread R. Joseph Newton
Ned Cunningham wrote: > Wouldn't it be better to not waste your time with this kind of response??? > > Ned Cunningham > POS Systems Development Hi Ned, I'd say that it depends on whether you see the OP as a potential programmer. If so, then no, it would not be better. If the OP takes a hint an

Re: Search Replace in multiple files

2004-02-07 Thread Rob Dixon
John W. Krahn wrote: > > Chetak Sasalu wrote: > > > > Hi, > > Hello, > > > I have to search and replace 'foo' to 'bar' in all the files in a > > directory(has subdirectories). > > The files are about 40k in size. > > > > On the command line I would do it as, > > find ./mydir/ -type f -print | xargs

Re: Search Replace in multiple files

2004-02-07 Thread Rob Dixon
Jan Eden wrote: > > Rob Dixon wrote: > > >John W. Krahn wrote: > > >> use File::Find; > >> local ( $^I, @ARGV ) = ''; > >> find( { no_chdir => 1, wanted => sub { -f and push @ARGV, $_ } }, './mydir' ); > >> s/foo/bar/g, print while <>; > > > >Thanks John. > > > >I missed the 'has subdirectories'

Re: Search Replace in multiple files

2004-02-07 Thread Jan Eden
Rob Dixon wrote: >Jan Eden wrote: >> >>Rob Dixon wrote: >> >>>John W. Krahn wrote: >> use File::Find; local ( $^I, @ARGV ) = ''; find( { no_chdir => 1, wanted => sub { -f and push @ARGV, $_ } }, './mydir' ); s/foo/bar/g, print while <>; >>> >>>Thanks John. >>> >>>I missed the 'has sub

RE: Search Replace in multiple files

2004-02-10 Thread chetak.sasalu
Hello, I came back to office after an extended weekend and realized that my words might have irked some of you. But let me explain. I agree, acquiring the 'mental tools' to do it myself is always the best way. I had tried out a few sample scripts myself (most of them failed). After spend

Re: Search Replace in multiple files

2004-02-11 Thread Rob Dixon
Chetak Sasalu wrote: > > I came back to office after an extended weekend and realized that my words > might have irked some of you. 'Irked' is a good word. I'll happily forgive just because of that, plus the fact that I know that I also can be irksome. Rob -- To unsubscribe, e-mail: [EMAIL PR

search replace saved to a variable

2009-09-02 Thread Noah Garrett Wallach
Hi there, what is the way to collapse this search/replace to one line? my $filename_cmd = $cmd[-1]; my $filename_cmd =~ s/\s/\./; Cheers, Noah -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: search replace one liner problem

2007-09-17 Thread John W. Krahn
jrpfinch wrote: I would like to execute the following regex on a file: s/(\$Revision:\s+)(\d+\.\d+)(\s+\$.+use constant VERSION\s+=> ")(.+?) (")/$1$2$3Revision $2$5/gs I am doing this in bash as follows: REGEX='s/(\$Revision:\s+)(\d+\.\d+)(\s+\$.+use constant VERSION\s+=> ") (.+?)(")/$1$2$3Rev

Re: search replace one liner problem

2007-10-09 Thread jrpfinch
Thanks very much - this works Jon -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: WhiteSpace - Map, search replace, split

2005-04-20 Thread Paul Kraus
> but this does not > my @record = map ( $_=~ s/^\s+|\s+$//g,(split /\|/,$_) ); Ok i get it. I just need to have it based on a block. Not sure why both will not work though. my @record = map {$_=~s/^\s+|\s+$//g}(split/\|/,$_); -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comm

Re: WhiteSpace - Map, search replace, split

2005-04-20 Thread Offer Kaye
On 4/20/05, Paul Kraus wrote: > Why does this work > my $date = 'one | two |three |'; > my @record = map ( whitespace($_), (split /\|/,$_) ); No, it won't work - you need to replace the $_ at the end with $date > sub whitespace { > my $string = shift; > $string =~ s/^\s+|\s+$//g

Re: WhiteSpace - Map, search replace, split

2005-04-20 Thread John W. Krahn
Paul Kraus wrote: Why does this work my $date = 'one | two |three |'; my @record = map ( whitespace($_), (split /\|/,$_) ); sub whitespace { my $string = shift; $string =~ s/^\s+|\s+$//g; return $string; } but this does not my @record = map ( $_=~ s/^\s+|\s+$//g,(split /\|/

Re: WhiteSpace - Map, search replace, split

2005-04-20 Thread FreeFall
On Wed, 20 Apr 2005 17:04:50 +0300 Offer Kaye <[EMAIL PROTECTED]> wrote: > On 4/20/05, Paul Kraus wrote: > > Why does this work > > my $date = 'one | two |three |'; > > my @record = map ( whitespace($_), (split /\|/,$_) ); > > No, it won't work - you need to replace the $_ at the en

Re: WhiteSpace - Map, search replace, split

2005-04-20 Thread Offer Kaye
On 4/21/05, FreeFall wrote: > > 3. But there's an even easier way, without having to use map: > > my @record = split /\s*\|\s*/,$date; > > -->this seems it cant delete spaces of the last element. > Have you tried it? -- Offer Kaye -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additiona

Re: WhiteSpace - Map, search replace, split

2005-04-20 Thread FreeFall
On Thu, 21 Apr 2005 08:31:27 +0300 Offer Kaye <[EMAIL PROTECTED]> wrote: > On 4/21/05, FreeFall wrote: > > > 3. But there's an even easier way, without having to use map: > > > my @record = split /\s*\|\s*/,$date; > > > > -->this seems it cant delete spaces of the last element. > > > > Have

Re: WhiteSpace - Map, search replace, split

2005-04-21 Thread Offer Kaye
On 4/21/05, FreeFall wrote: > Sure I did with Paul's example data : > $date = 'one | two |three |'; > And I tried to change the regx /\s*\|\s*/ to /s*\|?\s*/ and it worked. What > do you think? I think that's very strange. Here is my version: > perl -MData::Dumper -we'use strict; my $

Re: WhiteSpace - Map, search replace, split

2005-04-21 Thread FreeFall
On Thu, 21 Apr 2005 10:06:24 +0300 Offer Kaye <[EMAIL PROTECTED]> wrote: > On 4/21/05, FreeFall wrote: > > Sure I did with Paul's example data : > > $date = 'one | two |three |'; > > And I tried to change the regx /\s*\|\s*/ to /s*\|?\s*/ and it worked. What > > do you think? > > I t

Search replace using 2 lines for pattern

2004-01-18 Thread Bertrand Mansion
Hi, I have a big mail archive in which the From... top header has disappeared and has been replaced by an empty newline. I know it is above the first Received: header so I can locate it. The mail headers start like this: Received: from smtpout.mac.com ([204.179.120.85]) by lists.apple.com (8.1

Re: search replace saved to a variable

2009-09-02 Thread Jim Gibson
At 7:22 PM -0700 9/2/09, Noah Garrett Wallach wrote: Hi there, what is the way to collapse this search/replace to one line? my $filename_cmd = $cmd[-1]; my $filename_cmd =~ s/\s/\./; (my $filename_cmd = $cmd[-1]) =~ s/\s/\./; -- Jim Gibson jimsgib...@gmail.com -- To

Re: search replace saved to a variable

2009-09-02 Thread Noah Garrett Wallach
Jim Gibson wrote: At 7:22 PM -0700 9/2/09, Noah Garrett Wallach wrote: Hi there, what is the way to collapse this search/replace to one line? my $filename_cmd = $cmd[-1]; my $filename_cmd =~ s/\s/\./; (my $filename_cmd = $cmd[-1]) =~ s/\s/\./; thanks, okay a step further

Re: search replace saved to a variable

2009-09-02 Thread Uri Guttman
>>>>> "NGW" == Noah Garrett Wallach writes: NGW> Jim Gibson wrote: >> At 7:22 PM -0700 9/2/09, Noah Garrett Wallach wrote: >>> Hi there, >>> >>> what is the way to collapse this search/replace to one line? >>&

Re: search replace saved to a variable

2009-09-03 Thread Jenda Krynicky
From: Noah Garrett Wallach > okay a step further - is there a way to make the following a one liner? > > (my $filename_cmd = $cmd[-1]) =~ s/\|//g; > $filename_cmd =~ s/\s+/\./g; > $filename_cmd =~ s/save.*//g; There's no point in making it a one liner. Plus anything may be writen

RE: Search replace using 2 lines for pattern

2004-01-18 Thread Charles K. Clarkson
Bertrand Mansion <[EMAIL PROTECTED]> wrote: : [snip] : I have tried many times with no success. I can easily change : the "Received:" header to be : "From [EMAIL PROTECTED]:" but as there : are more than one "Received:" header, they all get replaced, : which is bad. : : I think I need a regex tha

Re: Search replace using 2 lines for pattern

2004-01-18 Thread Bertrand Mansion
<[EMAIL PROTECTED]> wrote : > Bertrand Mansion <[EMAIL PROTECTED]> wrote: > : > [snip] > : I have tried many times with no success. I can easily change > : the "Received:" header to be > : "From [EMAIL PROTECTED]:" but as there > : are more than one "Received:" header, they all get replaced, > :

RE: Search replace using 2 lines for pattern

2004-01-18 Thread Charles K. Clarkson
: -Original Message- : From: Bertrand Mansion [mailto:[EMAIL PROTECTED] : Sent: Sunday, January 18, 2004 7:56 AM : To: Charles K. Clarkson; [EMAIL PROTECTED] : Subject: Re: Search replace using 2 lines for pattern : : : <[EMAIL PROTECTED]> wrote : : : > Bertrand Mansio

How to search & replace only the first 3 digitsof a 10 digit #? Newbie asks!

2002-01-30 Thread Mike Charles
What regular expression might I use to replace area codes in a telephone #(or just the first 3 digits of a number. I can't use just a simple search and replace. For example: 4062324064 The new # would change to ex:302233024. I of course only want the area code or the first 3 digits to be s

RE: How to search & replace only the first 3 digitsof a 10 digit #? Newbie asks!

2002-01-30 Thread Timothy Johnson
beginning of the word, using the ^, like this:   $phonenumber =~ s/^406/302/;     -Original Message-From: Mike Charles [mailto:[EMAIL PROTECTED]]Sent: Wednesday, January 30, 2002 4:52 PMTo: [EMAIL PROTECTED]Subject: How to search & replace only the first 3 digitsof a 10 digit #? Ne

Re: How to search & replace only the first 3 digitsof a 10 digit #? Newbie asks!

2002-01-30 Thread Kristina Nairn
ke Charles To: [EMAIL PROTECTED] Sent: Wednesday, January 30, 2002 6:52 PM Subject: How to search & replace only the first 3 digitsof a 10 digit #? Newbie asks! What regular expression might I use to replace area codes in a telephone #(or just the first 3 digits of a n

Re: How to search & replace only the first 3 digitsof a 10 digit #? Newbie asks!

2002-01-30 Thread Kristina Nairn
ke Charles To: [EMAIL PROTECTED] Sent: Wednesday, January 30, 2002 6:52 PM Subject: How to search & replace only the first 3 digitsof a 10 digit #? Newbie asks! What regular expression might I use to replace area codes in a telephone #(or just the first 3 digits of a n