I am trying to sort a file alphabetically by the second column of each line, which contain uppercase names. An example file:
1:JOHN:Morgan:90:24 2:MIKE:Smith:95:11 3:JAYSON:Ty:99:9 4:TYLER:Edward:89:5 This is my bash script:
file="/home/here.txt" while IFS=: read -r f1 f2 f3 f4 f5 do tput cup $f1 0 ;echo "$f2 $f1 $f3 $f4 $f5" done <"$file" I came up to here to sort them, but this only switches places of f2 with f1.