Sorting
Put a file's lines in alphabetical order.
sort prints the lines of a file in alphabetical order. Compare it with the cat from earlier: the shopping list is the same, just tidied.
The important part: sort does NOT change the file. It shows you a sorted copy and leaves the original alone, which is why it is so safe to play with. cat the file afterwards and you will see it is exactly as it was.
sort -r does the same thing backwards.
sort shopping.txtShow the lines in order.sort -r shopping.txtReverse order.cat shopping.txtThe file itself, unchanged.Your task
- ○Sort shopping.txt
- ○Check the file itself has not changed
Open this level in your browser to type the commands at a live terminal that answers back.