Finally the command that prompted the creation of cmd.net in the first place: uniq.
Before implementing the command, I had to find out which options the default Linux implementations provided.
I used these pages as guideline:
- uniq on OpenGroup, with examples (used as test cases)
The resulting command filters unique lines from stdin (or a piped input file) to stdout, and supports these options:
uniq [parameters] displays unique lines in sorted file -u unique lines only -d repeated lines only -c display line count -i ignore case -f [ignore fields] ignore number of fields -s [skip characters] skip number of characters -w [compare characters] compare number of characters -in [encoding] input encoding -ci [culture] culture info -out [encoding] output encoding uniq 0.10.4117.37457 cmd.net 0.10.0.0 (c) by devio.at 2011
Note that uniq only analyzes subsequent lines of text in the file. Thus it only operates correctly on a pre-sorted file. If the input is not sorted, equal lines may be output more than once (but not subsequently).
The first version of cmd.net is available for download here, and contains the commands described in this post.