Last active
December 19, 2015 01:39
-
-
Save Woody2143/5877757 to your computer and use it in GitHub Desktop.
My first time using a Schwartzian-transform
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./Schwartzian.pl | |
$VAR1 = [ | |
'/data/switch/cdr/SWITCH_20130627_151800', | |
'/data/switch/cdr/SWITCH_20130627_151500', | |
'/data/switch/cdr/SWITCH_20130627_151900', | |
'/data/switch/cdr/SWITCH_20130627_151700', | |
'/data/switch/cdr/SWITCH_20130627_151600', | |
'/data/switch/otherCDR/SWITCH_20130627_151900', | |
'/data/switch/otherCDR/SWITCH_20130627_151600', | |
'/data/switch/otherCDR/SWITCH_20130627_151800', | |
'/data/switch/otherCDR/SWITCH_20130627_151500', | |
'/data/switch/otherCDR/SWITCH_20130627_151700' | |
]; | |
$VAR1 = [ | |
'/data/switch/cdr/SWITCH_20130627_151500', | |
'/data/switch/otherCDR/SWITCH_20130627_151500', | |
'/data/switch/cdr/SWITCH_20130627_151600', | |
'/data/switch/otherCDR/SWITCH_20130627_151600', | |
'/data/switch/cdr/SWITCH_20130627_151700', | |
'/data/switch/otherCDR/SWITCH_20130627_151700', | |
'/data/switch/cdr/SWITCH_20130627_151800', | |
'/data/switch/otherCDR/SWITCH_20130627_151800', | |
'/data/switch/cdr/SWITCH_20130627_151900', | |
'/data/switch/otherCDR/SWITCH_20130627_151900' | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/perlbrew/perls/cdrtools/bin/perl | |
use Modern::Perl; | |
use Data::Dumper; | |
my @files = qw( | |
/data/switch/cdr/SWITCH_20130627_151800 | |
/data/switch/cdr/SWITCH_20130627_151500 | |
/data/switch/cdr/SWITCH_20130627_151900 | |
/data/switch/cdr/SWITCH_20130627_151700 | |
/data/switch/cdr/SWITCH_20130627_151600 | |
/data/switch/otherCDR/SWITCH_20130627_151900 | |
/data/switch/otherCDR/SWITCH_20130627_151600 | |
/data/switch/otherCDR/SWITCH_20130627_151800 | |
/data/switch/otherCDR/SWITCH_20130627_151500 | |
/data/switch/otherCDR/SWITCH_20130627_151700 | |
); | |
print Dumper \@files; | |
my @sorted = map { $_->[0] } | |
sort { $a->[1] <=> $b->[1] } | |
map { [$_, $_=~ /SWITCH_(?:\d{8})_(\d{6})/] } | |
@files; | |
print Dumper \@sorted; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment