RE: inserting a string in between two other strings

2004-04-08 Thread Jayakumar Rajagopal
MAIL PROTECTED] Sent: Thursday, April 08, 2004 2:01 PM To: James Edward Gray II Cc: Perl Beginners Subject: Re: inserting a string in between two other strings this works! thanks so much and here is another solution to share... awk '{print $1" " $2}' /tmp/file

Re: inserting a string in between two other strings

2004-04-08 Thread DBSMITH
OTECTED]> 04/08/2004 01:12 PM To: [EMAIL PROTECTED] cc: Perl Beginners <[EMAIL PROTECTED]> Subject: Re: inserting a string in between two other strings On Apr 8, 2004, at 12:01 PM, [EMAIL PROTECTED] wrote: > Does anyone have a one liner using per

Re: inserting a string in between two other strings

2004-04-08 Thread gohaku
On Apr 8, 2004, at 1:01 PM, [EMAIL PROTECTED] wrote: Does anyone have a one liner using perl, awk or sed that will insert "mb" between the "6" and "f" ? For example, 144.06 free There's probably a shorter way but I have: $str = '144.06 free'; $str =~ s/6.*?free/6mb free/si; print $str; -- T

Re: inserting a string in between two other strings

2004-04-08 Thread James Edward Gray II
On Apr 8, 2004, at 12:01 PM, [EMAIL PROTECTED] wrote: Does anyone have a one liner using perl, awk or sed that will insert "mb" between the "6" and "f" ? For example, 144.06 free Not exactly what you asked for, but try: perl -pi.bak -e 's/(\d)\s*(free)/$1mb $2/g' file_to_modify James -- To