perl -e "print sort {chomp($x=$a); chomp($y=$b); $x cmp $y} <>" file.txt
The following is also a bit challenged in the beauty stakes but avoids the repetitive chomp'ing of the lines. Tested under both M$ shell (with double quotes) and Solaris ksh (with single-quotes).
perl -e "print map{qq{$_$/}} sort map{chomp; $_} <>;" file.txt
I hope this is of interest.
Cheers,
JohnGG
In reply to Re^3: Need Help! Two Dimentional Array Sorting
by johngg
in thread Need Help! Two Dimentional Array Sorting
by nashkab
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |