View Single Post
  #6  
Old September 4th 18, 06:55 PM posted to alt.windows7.general,microsoft.public.windowsxp.general
Frank Slootweg
external usenet poster
 
Posts: 1,226
Default Merge text files & then sort unique in DOS

Grease Monkey wrote:
Replying to 09/04 JJ

You can sort the contents of a text file using the SORT program. e.g.

type file.txt | sort


Yep. If it were Linux, it would simply be piped to "sort -u".

But removing duplicate lines is not possible using SORT, because it simple
doesn't have such capability built it.


Yep. That's why I asked the question.

[...]
But I was hoping for a DOS command that sorted uniquely.


Paul already gave a solution for a Linux-like (GNU) sort(1).

Since you seem to be used to Linux, I strongly recommend to install
Cygwin [1] and have all the Linux-like commands you like, in a 'DOS'
Command Prompt window or/and in a bash(1) window.

That way, you have the best of both worlds.

FWIW, I have a - three and a half decade - (professional) UNIX
background and have always used UNIX tools under MS-DOS/MS-Windows. I've
been using Cygwin for some 15-20 years now (see my User-Agent: header).

[1] http://cygwin.com
Ads