Friends,
I have .txt file with 3 millions of rows.
File1.txt
ABC1|A|ABCD1|XYZ1
ABC2|P|ABCD2|XYZ2
ABC3|A|ABCD3|XYZ3
ABC4|P|ABCD4|XYZ4
If second field has value P then print the entire line.
Thanks in advance for your help,
Prashant
Friends,
I have .txt file with 3 millions of rows.
File1.txt
ABC1|A|ABCD1|XYZ1
ABC2|P|ABCD2|XYZ2
ABC3|A|ABCD3|XYZ3
ABC4|P|ABCD4|XYZ4
If second field has value P then print the entire line.
Thanks in advance for your help,
Prashant
awk -F'|' ' $2=="P" ' infile > outfile
awk -F"|" '{if ($2 == "P") print $0}' File1.txt
Thank you for your help and quick reply.
For multiple field is this the right syntax?
awk -F'|' '$2=="P", $4=="XYZ4"' infile > outfile
Thanks,
Prashant
awk -F'|' '$2=="P" && $4=="XYZ4"' infile > outfile
Please read the forum rules and use [code] tags.