Checking for a null column in a csv file | awk -F '\\|' '$3==""' file.txt

I have a delimited file with the following syntax:

A|B|C|D|E
How to find the count of records having null (empty) value in their third column in every ro

One way:
awk -F"|" '{if (length($3) == 0) ++count } END { print count }' yourfile
% cat file.txt
A|B|C|D|E
A|B|C|D|E
A|B||D|E

% awk -F '\\|' '$3==""' file.txt
A|B||D|E

Comments

Popular posts from this blog

HAproxy logging

tomcat catalina coyote jasper cluster

NFS mount add in fstab _netdev instead of default | firewall-cmd --list-all