|
Delete help
Please give me some hints with awk or something, to delete the lines corresponding to a fixed 2nd field, for which A line is absent.
$ cat file.txt
#Test file
a 1 2232 ert
a 1 679 asd
A 1 12 oio
a 2 131 sd
a 2 56 adsad
a 2 567 sassa
A 2 90 asd
a 4 234 gfg
a 4 566 erer
a 5 233 yu
A 5 232 yuyu
Code:
$ cat file.txt
#Test file
a 1 2232 ert
a 1 679 asd
A 1 12 oio
a 2 131 sd
a 2 56 adsad
a 2 567 sassa
A 2 90 asd
a 4 234 gfg
a 4 566 erer
a 5 233 yu
A 5 232 yuyu
-->
Code:
$ cat file.txt
#Test file
a 1 2232 ert
a 1 679 asd
A 1 12 oio
a 2 131 sd
a 2 56 adsad
a 2 567 sassa
A 2 90 asd
a 4 234 gfg
a 4 566 erer
a 5 233 yu
A 5 232 yuyu
So the required output is something like this for the above file:
#Test file
a 1 2232 ert
a 1 679 asd
A 1 12 oio
a 2 131 sd
a 2 56 adsad
a 2 567 sassa
A 2 90 asd
a 5 233 yu
A 5 232 yuyu
Code:
#Test file
a 1 2232 ert
a 1 679 asd
A 1 12 oio
a 2 131 sd
a 2 56 adsad
a 2 567 sassa
A 2 90 asd
a 5 233 yu
A 5 232 yuyu
-->
Code:
#Test file
a 1 2232 ert
a 1 679 asd
A 1 12 oio
a 2 131 sd
a 2 56 adsad
a 2 567 sassa
A 2 90 asd
a 5 233 yu
A 5 232 yuyu
Thank you.
|