Timeline for Why *not* parse `ls` (and what to do instead)?
Current License: CC BY-SA 3.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 21, 2023 at 3:57 | comment | added | Martin Kealey |
As @dave_thompson_085 notes, uniq only removes adjacent duplicates. In practice that means the input has to be sorted lexicographically, which obviates one of the few advantages of ls over a simple glob - that you can sort by other fields, such as mtime or inode-type.
|
|
| Aug 26, 2023 at 5:22 | comment | added | dave_thompson_085 |
uniq only removes (or counts or selects) adjacent duplicate lines, so any implementation that isn't O(1) space and O(n) time is brain-dead.
|
|
| Jan 10, 2016 at 11:12 | comment | added | Wildcard | Of course, as mentioned in comments under another answer, the statement "...you've demonstrated you can create a solution that parses ls and gives the right result..." is actually not true. | |
| May 14, 2014 at 15:17 | history | edited | Voo | CC BY-SA 3.0 |
added 20 characters in body
|
| May 14, 2014 at 15:11 | history | answered | Voo | CC BY-SA 3.0 |