From: Todd on 11 Jun 2010 23:46 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 11 Jun 2010 23:54 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 11 Jun 2010 23:56 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 12 Jun 2010 13:20 > 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 12 Jun 2010 14:48 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...
|
Next
|
Last
Pages: 1 2 3 Prev: GoogleEarth and CentOS glibc problem Next: 2010 FIFA World Cup Brazil football jersey |