sorting a file in linux and copying it to the tmp file in one command

vanillathunder722

Active Member
Joined
Jan 14, 2011
Messages
66
Reaction score
0
Location
durban
Hey i forgot how to do that, so far i've created a new directory and used the touch command to create a file. Ive added few text in the file and now i want to sort the text to alphabetical orders(that's easy) and after sorting i want to output the result into another file in the tmp directory. how will i do that?
 
Im not well versed in bash scripting but im sure it can be done.

If it was my problem to solve, I would do it all in python. since most Linux Distros (and MAC OSX afaik) come with a python interpreter out of the box it can be done

type python in terminal and it should show ">>"

sorry if this may not be the solution youre looking for

Python is really easy
 
The sort command should do it:

To sort /tmp/unsorted:

Code:
sort < /tmp/unsorted > /tmp/sorted
 
Top
Sign up to the MyBroadband newsletter
X