perl -e 'push @file,$_ while<>;print sort {$a <=> $b} @file' test.txt #### perl -e "push @file,$_ while<>;print sort {$a <=> $b} @file" test.txt #### 1 b005824 134 b005376 402 astamen 972 achin00 181847 azeleke 1260896 abadeno