in reply to sorting a hash by key
sort -n /tmp/data # make sure that it's a real tab char in there for the output # note different sort params as example sort -t '|' -k 1 -n /tmp/data | cut -d '|' --output-delimiter=' ' + -f 1,2 # and to completely mimic the output of your code: sort -n /tmp/data | perl -F'\|' -nae 'print "\t$F[0]\t\t$F[1]";' sort -n /tmp/d | awk -F \| '{ print "\t" $1 "\t\t" $2 }'
|
|---|