RE: Line Swap

2006-03-16 Thread Jeff Pang
Hello,Sharmila, The lines that you want to swap seems so ruleless,so it's maybe hard to find a good way for you. If you just want to handle the case listed below,I'll give a simple way: $ cat t.txt $sc:(.+) (.+) $tic:(.+) $ perl -e '@tmp=<>;print shift @tmp;print reverse @tmp' t.txt $sc:(.+)

RE: Line Swap

2006-03-16 Thread sharmila
: Thursday, March 16, 2006 3:03 PM To: [EMAIL PROTECTED] Subject: RE: Line Swap try attached program it'll swap last two lines -Original Message- From: sharmila [mailto:[EMAIL PROTECTED] Sent: Thursday, March 16, 2006 11:43 AM To: [EMAIL PROTECTED]; beginners@perl.org Subject: RE:

RE: Line Swap

2006-03-15 Thread sharmila
Hi, Thanks for your help and the below suggested solution works only if we have 2 lines to swap. But I am trying out line swap for more than 2 lines. Could you please help me on how to do it? Input: $sc:(.+) (.+) $tic:(.+) Output: $sc:(.+) $tic:(.+) (.+) Note: Also the "reverse&quo

Re: Line Swap

2006-03-14 Thread Jeff Pang
> >Input: > >$dc:[dot 1980] >$su:UNITED STATES > >Output: > >$su:UNITED STATES >$dc:[dot 1980] > You could read these input lines into an array,then call 'reverse' to do that for you. See 'perldoc -f reverse' please. Also give an example here: $ perl -e '@arr=qw/aa bb/;print join " ",reverse @a

Line Swap

2006-03-14 Thread sharmila
Hi, I am trying out to swap/move lines of text in perl. Is this is possible? If so, please help me out on how to swap the lines. Input: $dc:[dot 1980] $su:UNITED STATES Output: $su:UNITED STATES $dc:[dot 1980] Thanks and regards, Sharmila Confidentiality Notice: This transmittal is a co