List Info

Thread: Sorting help




Sorting help
user name
2007-06-12 15:04:12
Below is the little progress I had made. I hope you can help me out with the rest. ; I will like to re-arrange some data in a file and save the file into a new one.
open (file, "lots_info") or die "can't" ;
open (new, ">new.txt") or die "can't";
data = <file&gt;;
while (<file&gt;)
{
if ($data[$x] =~ /(FinalValue="1&quot;)/ || $data[$x] =~ /(Final Value=&quot;2")/ || $data[$x] =~ /(Final Value=&quot;3")/ || $data[$x] =~ /(Final Value=&quot;4")/ || $data =~ /(Final Value=&quot;5")/
|| $data[$x] =~ /(Final Value=&quot;6")/)
{
#read the next four lines after each the "Final Value"; and re-arrange the position of the lines.&nbsp; At the end, I need to write the whole file into the " new.txt" and replace the name of the file with "lots_info", thus replacing the old "lots_info" file.


}


}
close file;
close new;

#BELOW ARE THE DATAS NOT IN ORDER

&nbsp;<C4Value=";75" />
 &nbsp;<LFValue="95" />
 &nbsp;<FMValue="89" />
 &nbsp;<ISValue="0.9" />

#BELOW ARE THE ORDER I WANT THEM TO BE:
  <FMValue=&quot;87" />
 &nbsp;<ISValue=";0.8" />
 &nbsp;<LFValue="95" />
 &nbsp;<C4Value="75" />

Thank you in advance
&nbsp;

--
rafiu mustapha
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Perl Programming" group.
To post to this group, send email to perl-programminggooglegroups.com
To unsubscribe from this group, send email to perl-programming-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/perl-programming
-~----------~----~----~----~------~----~------~--~---

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )