# this must get the job done
open (FH,'<filename');
@recs=<FH>;
close(FH);
chomp @recs;
$c=-1;
while ($c<$#recs){
$c++;
@parts = split(/\s+/,$recs[$c]);
$recs[$c] = "$parts[1]     $parts[0]";
}

open (FH,'>filename');
select(FH);
foreach $line (@recs){
print "$line\n";

}
close(FH);




----- Original Message -----
From: "Ashutosh Jog" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 21, 2002 1:32 PM
Subject: Need to change file columns


> Folks,
>
> I am wokring on a script which at one point works on a txt file. The
file's
> format is as under:
>
> 40        abc
> 35        def
> 28        ghi
> 17        jkl
> 08        mno
>
>
> What I want to do is take the column on the right and shift it entirely to
> the left and take the column on the left and move it to the right. So the
> file should ultimatly look like:
>
> abc        40
> def         35
> ghi         28
> jkl         17
> mno       08
>
> Any ideas how I can do so in perl? Any help is welcome.
>
> Thanks in Advance.
>
> -Cheers.
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to