So… there you are using Linux… you are using “cat,” and “sort,” and “tail” happily! Then you move over to your Windows box, and, “Ack!” You get frustrated not having the same power to control your text files there!
Or, in scenario two, you WANT to be able to sort a text file, and eliminate duplicate lines while doing so. Sigh! What to do?
Get the TextUtils for Windows!
GNU TextUtils for Windows
Download the file called, “textutils-2.1-1.exe”, and click on it to install the GNU TextUtil for Windows utilities. Then, go to “Start -> Control Panel -> System and click on the “Advanced” tab. Click on the “Environment Variables” button at the bottom of that screen, and then highlight the “System Variable” called “path” and click on the “Edit” button. Add this string to the very end of the line that is there:
;C:\Program Files\GnuWin32\bin
Note the “;” (semi-colon) at the beginning of the string! Click “OK,” then “OK,” and then “OK.” Now, you can use the command below, for instance, to solve the second scenario I used an example above:
sort file.txt | uniq > newfile.txt
This will take the contents of “file.txt” and sort each line, then eliminate duplicate lines, and then output the new data to a file called “newfile.txt” … how’s that for cool and geeky!?!