[Bug 1087753] Re: Output of ls not matching with sort, uniq combinations
C de-Avillez
hggdh2 at ubuntu.com
Fri Dec 7 22:04:57 UTC 2012
Thank you for opening this bug and helping make Ubuntu better.
I am not sure why you state 'the output (...) should be the same'. The
'uniq' info page states:
" By default, `uniq' prints its input lines, except that it discards
all but the first of adjacent repeated lines, so that no output lines
are repeated. Optionally, it can instead discard lines that are not
repeated, or all repeated lines.
The input need not be sorted, but repeated input lines are detected
only if they are adjacent. If you want to discard non-adjacent
duplicate lines, perhaps you want to use `sort -u'. "
In other words: input to 'uniq' should be sorted.
So, if there *are* duplicate entries in /usr/bin and /bin, running
'uniq' before sorting the 'ls' output *will* produce these duplicates.
Also, please be aware of potential locale effects on sorting (see
http://www.gnu.org/software/coreutils/faq/coreutils-faq.html#Sort-does-
not-sort-in-normal-order_0021 and
http://www.gnu.org/software/coreutils/faq/coreutils-faq.html#The-ls-
command-is-not-listing-files-in-a-normal-order_0021).
I am closing INVALID (not a bug). Please reopen if you do not agree, and
state why.
Finally, when opening a bug, please use 'ubuntu-bug' instead of directly
opening the bug on Launchpad. 'ubuntu-bug' will take care of collecting
minimal information from your system -- like package version, Ubuntu
version, etc --, which would be critical for a real bug, and are missing
here.
** Changed in: coreutils (Ubuntu)
Status: New => Invalid
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to coreutils in Ubuntu.
https://bugs.launchpad.net/bugs/1087753
Title:
Output of ls not matching with sort, uniq combinations
Status in “coreutils” package in Ubuntu:
Invalid
Bug description:
The output of the ls command as in the below,
ls /bin /usr/bin | sort | uniq | wc -l
ls /bin /usr/bin | uniq | sort | wc -l
While the above two commands try to fetch the list of two folders /bin and /usr/bin, which contain some names, the output either after sorting and taking unique values, or after taking unique values and then sorting, should be the same.
However, the output of the above two commands is not alike which needs to be checked as to where the problem is.
Note :- The above mentioned type of command/ filter is working fine if
we use single directory for listing instead of multiple directories.
Regards,
Jnaneswar,
+91-9246308079
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/1087753/+subscriptions
More information about the foundations-bugs
mailing list