I have a file with the following format:
Here there are ten columns but I need to print rows having blank records in any of the rows (except for 6th,8th and 9th column which will remain blank by default in each row(s)). Records are separated by "| " delimiter
I tried this :
But it says that "awk" is unable to parse the command. Can someone help in modifying it?
Code:
X|High|2|GIC|DM||XHM|||6 Months
X|Moderate|2|GIC|DM||XHM|||6 Months
X|High|2|GCM|DM||XSF|||6 Months
X|Med|2|GCM|DM||XSF|||6
I tried this :
Code:
awk -F'|' '{
for (i=1; i<=NF; ++i)
{
if($i == 6 || $i == 8 || $i == 9)
{
$i++;continue;
}
elseif ($i ~ /^[[:space:]]*$/)
{print NR, $0; next}}' file.txt