So I have a tab-separated input file that has blanks in a certain column like:
input_file:
A B C D
1 12 34 545
34 12 56
23 10 15 67
31 99 100
Now, my goal is to add all such rows with blanks to my output_file like:
output_file:
34 12 56
31 99 100
So I use this command to achieve my result-
awk -F $'\t' '$2 == ""' input_file >> output_file
This works great if column "B" is always in position 2, however it won't work if it is in a different position. How do I address column "B" by its name in the awk
command?