From: Todd on
Hi All,

I have a file:

abc
def
ghi
abc
jkl

How do I remove the second (duplicate) "abc" wih
a shell command?

May thanks,
-T
From: unruh on
On 2010-06-12, Todd <todd(a)invalid.com> wrote:
> Hi All,
>
> I have a file:
>
> abc
> def
> ghi
> abc
> jkl
>
> How do I remove the second (duplicate) "abc" wih
> a shell command?

sort -u?
Although that will change the order of the lines. (well not in this
case, but in general)

>
> May thanks,
> -T
From: Todd on
On 06/11/2010 08:46 PM, Todd wrote:
> Hi All,
>
> I have a file:
>
> abc
> def
> ghi
> abc
> jkl
>
> How do I remove the second (duplicate) "abc" wih
> a shell command?
>
> Many thanks,
> -T

Figured it out:

$ cat eraseme.txt
abc
def
ghi
abc
jkl


$ cat eraseme.txt | awk '!x[$0]++'
abc
def
ghi
jkl

From: John Reiser on
> abc
> def
> ghi
> abc
> jkl
>
> How do I remove the second (duplicate) "abc" wih
> a shell command?

The shell command 'uniq' has been around for more than 30 years.

--
From: Kenny McCormack on
In article <V6Odnf1CUvxDXI7RRVn_vwA(a)giganews.com>,
John Reiser <jreiserfl(a)comcast.net> wrote:
>> abc
>> def
>> ghi
>> abc
>> jkl
>>
>> How do I remove the second (duplicate) "abc" wih
>> a shell command?
>
>The shell command 'uniq' has been around for more than 30 years.

'uniq' has nothing to do with the instant problem.

'sort -u' is tangentially related, although unlikely to be what the OP
wants.

--
Just for a change of pace, this sig is *not* an obscure reference to
comp.lang.c...