4 ms·
Easier would be just use 'cat list_of_numbers | sort | uniq -u' to get the unique entries.
by wmu 8y ago
Easier would be just use 'cat list_of_numbers | sort | uniq -u' to get the unique entries.
- phireal 8y agoShorter still: sort -u < list_of_numbers
- adtac 8y agohttp://porkmail.org/era/unix/award.html http://porkmail.org/era/unix/award.html now, I'll wait for someone to post a link to the "UUOC award" award
- aepiepaey 8y agoAnd if you're using cat because it keeps the filename out of the way when editing the pipeline, then just put the redirect before the command instead, so instead of e.g. cat file | grep pattern | sort -u you can write < file grep pattern | sort -u and the filename is out of the way compared to grep pattern file | sort -u
- deleted 8y ago[deleted]
- wmu 8y agoThis is not the same. For sequence [5,5,4,3,3,2,1,1] "sort -u" returns [1,2,3,4,5], while "sort | uniq -u" returns [2,4].
- phireal 8y agoHuh, I didn't know that! Thanks.