-----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 [email protected] -----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-----
