A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Microsoft Windows XP » General XP issues or comments
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Merge text files & then sort unique in DOS



 
 
Thread Tools Display Modes
  #16  
Old September 6th 18, 08:33 PM posted to alt.windows7.general,microsoft.public.windowsxp.general
Reinhard Skarbal[_2_]
external usenet poster
 
Posts: 10
Default Merge text files & then sort unique in DOS

In article ,
says...

Merging text files is easy in DOS
for %f in (*.txt) do type "%f" output.txt

But how do you sort unique in DOS?


Hi

I fetched a long time ago a set of unix like tools for windows.
One exe is sort.exe. I renamed it to sortX.exe to avoid a conflict with
the windows sort. It's working with XP, ... windows-10.



Microsoft Windows [Version 10.0.17134.228]
(c) 2018 Microsoft Corporation. Alle Rechte vorbehalten.

C:\Users\Reinhardcd C:\TOOLS

C:\TOOLSsortX --help
Usage: sortX [OPTION]... [FILE]...
Write sorted concatenation of all FILE(s) to standard output.

Ordering options:

Mandatory arguments to long options are mandatory for short options too.
-b, --ignore-leading-blanks ignore leading blanks
-d, --dictionary-order consider only blanks and alphanumeric
characters
-f, --ignore-case fold lower case to upper case characters
-g, --general-numeric-sort compare according to general numerical
value
-i, --ignore-nonprinting consider only printable characters
-M, --month-sort compare (unknown) `JAN' ... `DEC'
-n, --numeric-sort compare according to string numerical
value
-r, --reverse reverse the result of comparisons

Other options:

-c, --check check whether input is sorted; do not sort
-k, --key=POS1[,POS2] start a key at POS1, end it at POS 2 (origin
1)
-m, --merge merge already sorted files; do not sort
-o, --output=FILE write result to FILE instead of standard
output
-s, --stable stabilize sort by disabling last-resort
comparison
-S, --buffer-size=SIZE use SIZE for main memory buffer
-t, --field-separator=SEP use SEP instead of non- to whitespace
transition
-T, --temporary-directory=DIR use DIR for temporaries, not $TMPDIR or
c:/temp
multiple options specify multiple
directories
-u, --unique with -c: check for strict ordering
otherwise: output only the first of an
equal run
-z, --zero-terminated end lines with 0 byte, not newline
--help display this help and exit
--version output version information and exit

POS is F[.C][OPTS], where F is the field number and C the character
position
in the field. OPTS is one or more single-letter ordering options, which
override global ordering options for that key. If no key is given, use
the
entire line as the key.

SIZE may be followed by the following multiplicative suffixes:
% 1% of memory, b 1, K 1024 (default), and so on for M, G, T, P, E, Z,
Y.

With no FILE, or when FILE is -, read standard input.

*** WARNING ***
The locale specified by the environment affects sort order.
Set LC_ALL=C to get the traditional sort order that uses
native byte values.

Report bugs to .

C:\TOOLS


Maybe you find "textutils" somewhere in the web.
If not I will put it on workdownload.com

Send a mail to


Regards
Reinhard
Ads
  #17  
Old September 7th 18, 05:03 AM posted to alt.windows7.general,microsoft.public.windowsxp.general
Grease Monkey
external usenet poster
 
Posts: 19
Default Merge text files & then sort unique in DOS

Replying to 09/06 Reinhard Skarbal

Maybe you find "textutils" somewhere in the web.
If not I will put it on workdownload.com


Just saw this.

Textutils is dead
http://www.gnu.org/software/textutils/

But it's in coreutils I think
http://www.gnu.org/software/coreutils/coreutils.html

Plenty of tarballs here
http://ftp.gnu.org/gnu/coreutils/

I see source code but no Windows binaries yet.
  #18  
Old September 7th 18, 05:54 AM posted to alt.windows7.general,microsoft.public.windowsxp.general
Paul[_32_]
external usenet poster
 
Posts: 11,873
Default Merge text files & then sort unique in DOS

Grease Monkey wrote:
Replying to 09/06 Reinhard Skarbal

Maybe you find "textutils" somewhere in the web.
If not I will put it on workdownload.com


Just saw this.

Textutils is dead
http://www.gnu.org/software/textutils/

But it's in coreutils I think
http://www.gnu.org/software/coreutils/coreutils.html

Plenty of tarballs here
http://ftp.gnu.org/gnu/coreutils/

I see source code but no Windows binaries yet.


You are a naughty Grease Monkey.

Coreutils for Win32 is here.

http://gnuwin32.sourceforge.net/packages.html

This software hasn't been touched in like, ten years.
It still works great.

http://gnuwin32.sourceforge.net/packages/coreutils.htm

The binaries ZIP gives the actual executable EXE files.
Like sort.exe.

The Dependencies ZIP gives the DLL files. In this
kit, there are two DLLs that should sit next to the
EXE. If you don't install the DLLs, the "sort.exe"
will whine when you start it. That's one of the nicer
features of this software, is the dynamic DLL loader
method makes all the dependencies quite obvious
at runtime.

If you used the complete package, it might attempt
to add a certain "bin" directory to your %path%
variable. Which would "automate" things for you.
I can't be bothered with that, and just toss the
"sort.exe" and the two DLLs, into my working
directory. I use a scratch area for a lot of
experiments, and just assemble the tools I need
in the scratch.

Using cygwin can do much the same thing, but
the attention to detail differs between the
two environments. Cygwin programs have different
issues than gnuwin32 ones.

To give another kind of example, in Windows 10 there
is the Bash shell. And the "line endings" used are
"wrong" for Windows. You should find the gnuwin32
stuff OK in that regard.

I can't say right off hand, what the UTF-8 support
is like. Probably not good. So don't be surprised
if you pour something like that through one of
the tools, it doesn't work right.

But still, it's free, even though it's sourceforge,
those kits aren't booby trapped. You should be safe.

Paul
  #19  
Old September 7th 18, 06:46 AM posted to alt.windows7.general,microsoft.public.windowsxp.general
Grease Monkey
external usenet poster
 
Posts: 19
Default Merge text files & then sort unique in DOS

Replying to 09/06 Paul

This software hasn't been touched in like, ten years.
It still works great.

http://gnuwin32.sourceforge.net/packages/coreutils.htm


Got it!
https://sourceforge.net/projects/gnu...tils-5.3.0.exe
https://vorboss.dl.sourceforge.net/p...tils-5.3.0.exe

This is the CoreUtils Setup Wizard which installs CoreUtils 5.3.0.
The installer literally added exactly 100 executables to Windows.
[.exe
basename.exe
cat.exe
chgrp.exe
chmod.exe
chown.exe
chroot.exe
cksum.exe
comm.exe
cp.exe
csplit.exe
cut.exe
date.exe
dd.exe
df.exe
dir.exe
dircolors.exe
dirname.exe
du.exe
echo.exe
env.exe
expand.exe
expr.exe
factor.exe
false.exe
fmt.exe
fold.exe
gdate.exe
gecho.exe
ginstall.exe
gln.exe
gmkdir.exe
grmdir.exe
groups
gsort.exe
head.exe
hostid.exe
hostname.exe
id.exe
install.exe
join.exe
kill.exe
libiconv2.dll
libintl3.dll
link.exe
ln.exe
logname.exe
ls.exe
md5sum.exe
mkdir.exe
mkfifo.exe
mknod.exe
mv.exe
nice.exe
nl.exe
nohup.exe
od.exe
paste.exe
pathchk.exe
pinky.exe
pr.exe
printenv.exe
printf.exe
ptx.exe
pwd.exe
readlink.exe
rm.exe
rmdir.exe
seq.exe
setuidgid.exe
sha1sum.exe
shred.exe
sleep.exe
sort.exe
split.exe
stat.exe
stty.exe
su.exe
sum.exe
sync.exe
tac.exe
tail.exe
tee.exe
test.exe
touch.exe
tr.exe
true.exe
tsort.exe
tty.exe
uname.exe
unexpand.exe
uniq.exe
unlink.exe
uptime.exe
users.exe
vdir.exe
wc.exe
who.exe
whoami.exe
yes.exe
  #20  
Old September 7th 18, 03:41 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

Paul wrote:
[...]

Coreutils for Win32 is here.

http://gnuwin32.sourceforge.net/packages.html

This software hasn't been touched in like, ten years.
It still works great.

http://gnuwin32.sourceforge.net/packages/coreutils.htm

The binaries ZIP gives the actual executable EXE files.
Like sort.exe.


[...]

Using cygwin can do much the same thing, but
the attention to detail differs between the
two environments. Cygwin programs have different
issues than gnuwin32 ones.


Note that GnuWin does not contain any kind of shell (i.e. no bash,
ksh, csh, etc..). If you want/need a shell, for example for
making/running shell scripts, you need to get a shell from for example
Cygwin. If you need to get Cygwin for a shell, you might as well use
only Cygwin, instead of GnuWin plus Cygwin's shell.

http://gnuwin32.sourceforge.net/faq.html#How_do_I_run_shell_scripts

"How do I run shell scripts?

Shell scripts can be recognized by the first line #! /bin/sh. Such
shell scripts need a Unix shell to run. Such shells (Bash, Ksh or Csh)
are available from Cygwin, Djgpp, Uwin, and MS-Windows Services for
Unix (SFU). Alternatively, one may translate the script into
MS-Windows batch or script language."

Since Cygwin is much, much more complete than GnuWin and still
actively developed/maintained (instead 'dormant' for 10 years), it's
probably best to use GnuWin only if you only need some Unix commands and
nothing more.

[...]
  #21  
Old September 7th 18, 04:36 PM posted to alt.windows7.general,microsoft.public.windowsxp.general
Paul[_32_]
external usenet poster
 
Posts: 11,873
Default Merge text files & then sort unique in DOS

Frank Slootweg wrote:

it's
probably best to use GnuWin only if you only need some Unix commands and
nothing more.


Correct! Which is exactly the problem as stated by the OP.

Wants to pipe some crap, into a sort program with "unique" feature. Done.

Paul

  #23  
Old September 10th 18, 05:50 PM posted to alt.windows7.general,microsoft.public.windowsxp.general,alt.comp.os.windows-10,alt.comp.freeware,alt.comp.hardware.pc-homebuilt
Reinhard Skarbal[_2_]
external usenet poster
 
Posts: 10
Default Merge text files & then sort unique in DOS

In article ,
says...

In article ,
says...

On 9/4/2018 11:16 PM, Grease Monkey wrote:
Merging text files is easy in DOS
for %f in (*.txt) do type "%f" output.txt

But how do you sort unique in DOS?


MS DOS has a SORT.EXE if I remember correctly... it's such a long time
ago....


Yes, but it doesn't have a /unique option.

Powershell can do this, as can the Bash shell if you install that.

(only now seeing that this wasn't sent when I expected it to be!)


Hi

I fetched a long time ago a set of unix like tools for windows.
One exe is sort.exe. I renamed it to sortX.exe to avoid a conflict with
the windows sort. It's working with XP, ... windows-10.



Microsoft Windows [Version 10.0.17134.228]
(c) 2018 Microsoft Corporation. Alle Rechte vorbehalten.

C:\Users\Reinhardcd C:\TOOLS

C:\TOOLSsortX --help
Usage: sortX [OPTION]... [FILE]...
Write sorted concatenation of all FILE(s) to standard output.

Ordering options:

Mandatory arguments to long options are mandatory for short options too.
-b, --ignore-leading-blanks ignore leading blanks
-d, --dictionary-order consider only blanks and alphanumeric
characters
-f, --ignore-case fold lower case to upper case characters
-g, --general-numeric-sort compare according to general numerical
value
-i, --ignore-nonprinting consider only printable characters
-M, --month-sort compare (unknown) `JAN' ... `DEC'
-n, --numeric-sort compare according to string numerical
value
-r, --reverse reverse the result of comparisons

Other options:

-c, --check check whether input is sorted; do not sort
-k, --key=POS1[,POS2] start a key at POS1, end it at POS 2 (origin
1)
-m, --merge merge already sorted files; do not sort
-o, --output=FILE write result to FILE instead of standard
output
-s, --stable stabilize sort by disabling last-resort
comparison
-S, --buffer-size=SIZE use SIZE for main memory buffer
-t, --field-separator=SEP use SEP instead of non- to whitespace
transition
-T, --temporary-directory=DIR use DIR for temporaries, not $TMPDIR or
c:/temp
multiple options specify multiple
directories
-u, --unique with -c: check for strict ordering
otherwise: output only the first of an
equal run
-z, --zero-terminated end lines with 0 byte, not newline
--help display this help and exit
--version output version information and exit

POS is F[.C][OPTS], where F is the field number and C the character
position
in the field. OPTS is one or more single-letter ordering options, which
override global ordering options for that key. If no key is given, use
the
entire line as the key.

SIZE may be followed by the following multiplicative suffixes:
% 1% of memory, b 1, K 1024 (default), and so on for M, G, T, P, E, Z,
Y.

With no FILE, or when FILE is -, read standard input.

*** WARNING ***
The locale specified by the environment affects sort order.
Set LC_ALL=C to get the traditional sort order that uses
native byte values.

Report bugs to .

C:\TOOLS


Maybe you find "textutils" somewhere in the web.
If not I will put it on workdownload.com

Send a mail to


Regards
Reinhard
  #26  
Old September 20th 18, 01:12 PM posted to alt.windows7.general,microsoft.public.windowsxp.general
Mynews
external usenet poster
 
Posts: 5
Default Merge text files & then sort unique in DOS

"Paul" wrote in message news There is no UNIQUE option in MSDOS sort.
http://www.vfrazee.com/ms-dos/6.22/help/sort.htm


Paul I Use IrfanView

Click on the File Menu, select Slideshow.
A dialog allows you to select a directory
from which the files will be

Click the Sort button to choose a sort order by name, date, size or
extension.
Files may be sorted in ascending or descending order. To remove a sort,
click the no Sort option button.

Click Save filenames as TXT
and a dialog like Save As appears.
Give your slideshow a name
and click Save to have it stored
on the disk drive.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off






All times are GMT +1. The time now is 11:08 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 PCbanter.
The comments are property of their posters.