Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

delete rows equivalents 1

Status
Not open for further replies.

rossyeperez

Technical User
Feb 1, 2007
15
MX
If I have the following case:

a xxx h
b xxx xxx
c sss d
d ddd f
e ccc g
f ddd d
g xxx e
h ddd h
a b d e f h

In the vertical column I have a b c d e f g h in vertical mode and the horizontal row a b d e f h
if I compare vertical column with the horizontal row
I got that in the horizontal mode I have less leters in the same order, I miss the following in red :

a b c d e f g h

and I would like to get a file that erase rows in the vertical column that not exist in the horizontal row. ej (gren colors rows that I need erased that don't get macht with the vertical row):


a xxx h
b xxx xxx
c sss d
d ddd f
e ccc g
f ddd d
g xxx e
h ddd h
a b d e f h

the reference is the first line of the first column start with the leter 'a' and the comparision is with it column with the second line horizontally that start with the leter 'a'.

somebody can help me with it??
Thanks
Rossy



 
A starting point (awk program):
$1=="a"{
if(f){
for(i=1;i<=NF;++i) print x[$i]
print;split("",x)
f=0;next
}++f
}
{ x[$1]=$0 }

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top