in reply to Re: output unique lines only
in thread output unique lines only

Nearly every use of "sort | uniq" can be replaced with "sort -u".

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Replies are listed 'Best First'.
Re^3: output unique lines only
by l3v3l (Monk) on Dec 06, 2005 at 19:05 UTC
    the only reason to use sort and uniq in combination instead of "sort -u" that I can think of is to skip specific columns when looking for unique intances. example:
    ... RH_MEa0001bG06_5 710 14 16 Invalid starting position (14) RH_MEa0001bG06_4 710 125 12 GGGGGACACCTTCTCTCTCT... RH_MEa0001bG06_6 710 125 12 GGGGGACACCTTCTCTCTCT... ...
    sending a file containing this output to " | sort | uniq -f1" would compare each line and take the first instance that is unique (other than the column you want to skip, column 1 in this case) up to that point and give you :
    ... RH_MEa0001bG06_4 710 125 12 GGGGGACACCTTCTCTCTCT... RH_MEa0001bG06_5 710 14 16 Invalid starting position (14) ...