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
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
Could you also suggest how can I keep any other lines (e.g. in the above file the line "#Test file" or any other intermediate comment lines) in the output.
Thanks.