![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| finding duplicates in columns and removing lines | totus | Shell Programming and Scripting | 17 | 2 Days Ago 08:27 AM |
| Help removing lines with duplicated columns | yahyaaa | Shell Programming and Scripting | 14 | 05-17-2008 04:33 AM |
| Remove lines, Sorted with Time based columns using AWK & SORT | karthikn7974 | Shell Programming and Scripting | 1 | 05-09-2008 08:04 PM |
| sorting file content on columns | marshmallow | UNIX for Dummies Questions & Answers | 2 | 01-04-2007 09:10 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have a file which looks like
AA BB CC DD EE FF GG HH KK AA BB GG HH KK FF CC DD EE AA BB CC DD EE UU VV XX ZZ AA BB VV XX ZZ UU CC DD EE .... I want the script to give me only one line based on duplicate contents: AA BB CC DD EE FF GG HH KK AA BB CC DD EE UU VV XX ZZ |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Call me stupid but I don't follow what you are after here... the out put example you've given has two lines but you seem to be asking for one line? Please elaborate on what you are after
|
|
#3
|
||||
|
||||
|
I suppose he wahts something like this,
but for more general solution it would be better if we have more sample data: Code:
awk '{x[$3v$4v$5v$7v$8v$9]}
!($7v$8v$9v$3v$4v$5 in x)' v=" " filename
|
|
#4
|
|||
|
|||
|
As a clarification:
I am looking for one line per duplicate info. Therefore, the 4 lines input file (given as an example) is formed of two blocks, 2 lines each, containaing duplicate data. Thus the result is two lines. AA BB CC DD EE FF GG HH KK ----- First Block AA BB GG HH KK FF CC DD EE ----- First Block AA BB CC DD EE UU VV XX ZZ ----- Second Block AA BB VV XX ZZ UU CC DD EE ----- Second Blcok The results should be like the following: AA BB CC DD EE FF GG HH KK ----- Result for First Block AA BB CC DD EE UU VV XX ZZ ----- Result for Second Block I hope it is clear now! |
|
#5
|
|||
|
|||
|
Quote:
Your script did not work with me! (awk error) |
|
#6
|
||||
|
||||
|
Hm,
and you're not on Solaris? |
|
#7
|
|||
|
|||
| Google The UNIX and Linux Forums |