Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
20120824/ABC/input/daily/11337111.xml 20120710/ABC/input/daily/11337101.xml 20120330/ABC/input/daily/11337111.xml 20130614/ABC/input/daily/11337890.xml 20130120/ABC/input/daily/11337111.xml 20120206/ABC/input/daily/11337111.xml 20121005/ABC/input/daily/11337890.xml 20130110/ABC/input/daily/11337111.xml 20120923/ABC/input/daily/11337111.xml 20130416/ABC/input/daily/11337101.xml 20120404/ABC/input/daily/11337111.xml 20130211/ABC/input/daily/11337111.xml
This is the input file. Please tell me for a particular file, latest value in the first directory should match.
#!/usr/bin/perl open(INFO,"$ARGV[0]"); @array=<INFO>; close (INFO); @sortedarray=sort(@array); foreach $line(@sortedarray){ print "$line"; }
Example: output should be
20130211/ABC/input/daily/11337111.xml 20130416/ABC/input/daily/11337101.xml 20130614/ABC/input/daily/11337890.xml
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sort based on last and first value
by kcott (Archbishop) on Aug 26, 2013 at 10:56 UTC | |
|
Re: sort based on last and first value
by 2teez (Vicar) on Aug 26, 2013 at 11:02 UTC | |
|
Re: sort based on last and first value
by hdb (Monsignor) on Aug 26, 2013 at 11:07 UTC | |
by soonix (Chancellor) on Aug 27, 2013 at 09:47 UTC | |
|
Re: sort based on last and first value
by Corion (Patriarch) on Aug 26, 2013 at 10:17 UTC |