Hi,
I have a sample file in the following format.
000013560240|000013560240|001|P|155|99396|0||SS00325665|
000013560240|000013560240|002|P|17|99000|0||SS00325665|
000013560240|000013560240|002|F|-17|99000|0|R|SS00325665|
000013560240|000013560240|003|P|20|82270|0||SS00325665|
000013560240|000013560240|004|F|17|99000|0||SS00325665|
000012817460|000012817460|001|P|129.98|V2202|0||SS00425539|
000012817460|000012817460|001|F|-129.98|V2202|0|R|SS00425539|
000016132850|000016132850|001|P|59.99|E0607|0||SS00154667|
000016132850|000016132850|001|F|-59.99|E0607|0|R|SS00154667|
000016132850|000016132850|002|P|24|E1399|0||SS00154667|
000016132850|000016132850|002|F|-24|E1399|0|R|SS00154667|
000016132850|000016132850|003|F|59.99|E0607|0||SS00154667|
000016132850|000016132850|004|F|24|E1399|0||SS00154667|
I need the output file as below :
000013560240|000013560240|001|P|155|99396|0||SS00325665|
000013560240|000013560240|003|P|20|82270|0||SS00325665|
000013560240|000013560240|004|F|17|99000|0||SS00325665|
000016132850|000016132850|003|F|59.99|E0607|0||SS00154667|
000016132850|000016132850|004|F|24|E1399|0||SS00154667|
The logic is tom compare fields 3 and 5 and if field 5 has corresponding negative value which matched to the positive value based on field 3 , those records should be ignored.
This can be done in Perl using arrays but was wondering if this can be achieved through awk or sed or a shell script. Any help is appreciated.