bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: uniq command


From: Eric Blake
Subject: Re: uniq command
Date: Tue, 15 Dec 2009 18:44:44 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to doug caldwell on 12/15/2009 3:32 PM:
> I have written the following script to locate and remove duplicate lines from 
> a file;
>  sort -t: -k 2 -d ~/source/outadv/custfile -o extras 
>         uniq -d extras > extras1 | cat extras1 ;;  
> The system either ignores the uniq command or thinks that it is a file name 
> instead.

As written, your use of > and | on the same command is problematic - the
shell opens up a pipe, then spawns both uniq and cat, with both files
competing to write to the same file.  Depending on scheduling between the
two processes, your output will be lost.

Also, are you sure you want to sort from field 2 to the end of the line,
rather than just on field 2?  You probably meant something more like:

sort -t: -k 2,2 -d ~/source/outadv/custfile -o extras
uniq -d extras | tee extras1

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksoO4wACgkQ84KuGfSFAYBsFgCgiBjKJIFp9nLDZjuy/r2yKBwy
IOUAoIQNTq/5V68WM4m1CWT2GPj/X3mQ
=j8YX
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]