just wanted to check with you could this be done better:
awk -F"\t" '{
for (i = 1; i <= NF; i++) {
if ($i != "NULL") {
printf("%s%s", $i, FS);
}
}
printf("\n");
}' file1
The goal is to print only non-NULL
fields. For example:
echo "TestRecord001 NULL NULL Age 29 NULL NULL Name John" | awk -F"\t" '{
for (i = 1; i <= NF; i++) {
if ($i != "NULL") {
printf("%s%s", $i, FS);
}
}
printf("\n");
}'
will print out: TestRecord001 Age 29 Name John