Hi eveyone. I am trying to read a file using vi editor and sort its content inside the file alphabetically which is only names on CAPITAL LETTERS, second field (JOHN, MIKE, JAYSON and TYLER).
The file is smth like this inside:
1:JOHN:Morgan:90:24
2:MIKE:Smith:95:11
3:JAYSON:Ty:99:9
4:TYLER:Edward:89:5
This is my vi script:
file="/home/students/domie/wine.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.
Can someone help me?
thank you