How can sort lines in a file according to data in it? Say I have a file who looks like this:
1 23 54 89
2 65 23 77
9 89 67 90
8 78 93 11
3 74 99 32
And I want to sort it according to the first column like this:
1 23 54 89
2 65 23 77
3 74 99 32
8 78 93 11
9 89 67 90
It all has to be done in Bash.
sort is your go to.
sort <your_file>
Try using the sort command:
sort -n test.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With