$ cat junk.txt AGCT:0:370:1 AGGT:3:52:1 TGAA:2:233:0 AGAG:0:32:0 $ sort -t: -k2,3 junk.txt AGAG:0:32:0 AGCT:0:370:1 TGAA:2:233:0 AGGT:3:52:1