GNU bug report logs -
#17016
sort program question -- bug with program, or documentation or my misunderstanding
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Hi
My first posting.
I believe there is an omission in man pages for the sort in the Description
area section. One cannot successfully use -d or without including -f on the
line. Refer to man sort under Description
-d, --dictionary-order
consider only blanks and alphanumeric characters
I have the following lines in a file (see below as justification)
I want a file sorted as straight ascii sort. I eventually developed the two alternate command lines shown below, for two different purposes.
The undocumented bug is the requirement for the -f to be specified in order to have the sort work in the first of the two ASCII examples shown below,
otherwise the leading blank is ignored.
The first sort did not work for me unless the -f is specified. Nowhere in the man page does it stipulate that for -d option the -f must be specified.
That is the bug.
Did I not understand man sort or info sort (linux fedora 20) ?
Here are the two command lines and some sample lines as justification for my posting. I wish to sort a file shown below within the === by the first column
The following is the demo script
#!/bin/bash
LC_ALL=C
# to sort in ascii sequence where line ABCabc comes before abc use the following
sort -f -k1d -t '|' x -o ABCabc
# output will have lines with leading ABC text occurring before abc as per ascii table.
# The sort will not work if the -f is omitted.
# The undocumented requirement is the need to specify the -f
#
# to sort folding the in folded ascii sequence, where lines with sequence ABCbac sorts as AaBbCc ... use the following
# This part of the man pages is correct. Except we may specify the folding option in two ways
sort -t '|' -k1f x -o AaBbCc
or the line with sort -f -t '|' -k1 x -o AaBbCc
Try the first command or varients without the -f to sort in column 1 ascending sequence
Here is a text file, between the === to paste into VI Save it as x . and try to get the sort against the lines
NB, the leading blank for line 1 is to force the line to be first in the output
========
Host=fedora20.fedora20 | | scan from /home/leslie/Development/scandir
crc32.h |20140314 1736|bb96da74aa636110b822d116afbe36d82c1c0861|/home/leslie/Development/scandir
md5.h |20140314 1736|544728de8b8dc476109922cf5601a7cd6a103916|/home/leslie/Development/scandir
ABCbac |20140314 1901|6626094e11fee60bbe73529bd440a43961c022ce|/home/leslie/Development/scandir
scandir32.c |20140314 1738|1526c725bf00d8268b5319b125cebd2fbb001542|/home/leslie/Development/scandir
date1 |20140314 1901|97294e445cb75e611805024d5461bd07807e9157|/home/leslie/Development/scandir
sha1.o |20140314 1736|1ba673cd46bb246f7f380dc862f93b4737c1305c|/home/leslie/Development/scandir
dirdepth.c |20140314 1736|8779adf41bce65b45f597ba3731db55e81aa718a|/home/leslie/Development/scandir
md5Good.tar |20140314 1736|87ca9e022705250fe2635f87801bbf0fd2df0a0f|/home/leslie/Development/scandir
crc32.c |20140314 1736|cb8e353eedecba7d1c0fa2bdd871a508301b10d3|/home/leslie/Development/scandir
scandir32 |20140314 1738|ddc187abd0a991183f0d148ed1f069169c5b67ab|/home/leslie/Development/scandir
md5.c |20140314 1736|291145c0b852ec5cff52b361f2be75886f116bee|/home/leslie/Development/scandir
md5 |20140314 1736|a766f710c7f007fa930c808f1a25464f6c7fb1ae|/home/leslie/Development/scandir
scandir |20140314 1738|525b14d0c2ed42d7c6df168ad9606573df3fa97c|/home/leslie/Development/scandir
dirent.h |20140314 1736|281be8444edc7fdaf561cab6f86e80911f425041|/home/leslie/Development/scandir
test.sh |20140314 1736|7ebc56b604211a222c5a3fa6caf811207134fb3f|/home/leslie/Development/scandir
makefile |20140314 1736|8c13260814f42acb544cfd3eda64daf7a26241f3|/home/leslie/Development/scandir
sort.how |20140314 1859|08aff8bec844bbe8684f24e9e0e5635d73a0f364|/home/leslie/Development/scandir
scandirmd5 |20140314 1738|525b14d0c2ed42d7c6df168ad9606573df3fa97c|/home/leslie/Development/scandir
crc32.o |20140314 1736|0f3c8739e6ebc6b5d2c553687886fe47df1aa39c|/home/leslie/Development/scandir
DATE2 |20140314 1736|c31bd337d70c8d39ada367a889d623e19cd3c995|/home/leslie/Development/scandir
date2 |20140314 1901|97294e445cb75e611805024d5461bd07807e9157|/home/leslie/Development/scandir
sha1.h |20140314 1736|017eefa93cc9fe477881fa0986465b0a125b5aa5|/home/leslie/Development/scandir
scandirsha1.c |20140314 1738|a4ea776b95cb87047188353527128262d1059990|/home/leslie/Development/scandir
blacklist.txt |20140314 1736|28ec0b1ef6be98a520366ea63938e0a436b1db78|/home/leslie/Development/scandir/SOX/var
======
Trying different variations of the sort with the above file leads to some results that do not appear to me to be correct.
I have specified locale, and with some variants, locale appears to be ignored. The above file is as ASCII text, not utf8
Regards
Leslie
Mr. Leslie Satenstein
[Message part 2 (text/html, inline)]
This bug report was last modified 11 years and 121 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.