Re: print one occurance for duplicate entries
From: Harry (harryooopotter_at_hotmail.co_)
Date: 11/29/05
- Next message: caribou: "ssh command fails after a getline in an awk program"
- Previous message: luke: "Re: Env variable whit asterisk"
- In reply to: Ed Morton: "Re: print one occurance for duplicate entries"
- Next in thread: Harry: "Re: print one occurance for duplicate entries"
- Reply: Harry: "Re: print one occurance for duplicate entries"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 29 Nov 2005 08:09:25 GMT
Ed Morton wrote...
>> Ed Morton wrote...
>>>awk 'NR%2{t=$0;next}!($3 in f){f[$3];print t"\n"$0}' file
>but almost all solutions that use getline are bad awk style at best or,
>more commonly, dangerously buggy or just plain wrong. Try this instead:
>
>awk '/dcm/{t=$0;next}!($0 in f){f[$0];print t"\n"$0}' file
I shouldn't compare the whole line. You are right, when I combined your
two solutions together, it became this.
awk '/dcm/{t=$0;next}!($3 in f){f[$3];print t"\n"$0}' file
And it worked great when I examined a small portion of input vs
output. As I said, the input is 40000 lines long. I'll checked more
lines visually.
Thank you very much.
- Next message: caribou: "ssh command fails after a getline in an awk program"
- Previous message: luke: "Re: Env variable whit asterisk"
- In reply to: Ed Morton: "Re: print one occurance for duplicate entries"
- Next in thread: Harry: "Re: print one occurance for duplicate entries"
- Reply: Harry: "Re: print one occurance for duplicate entries"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|