Hi,
I've a pipe delimited file where I want to find out a number of lines where 1st 2nd and last field are null using awk/sed. Is it possible?
Thanks
Hi,
I've a pipe delimited file where I want to find out a number of lines where 1st 2nd and last field are null using awk/sed. Is it possible?
Thanks
awk -F\| ' !$1 || !$2 || !$NF { print NR, "empty field" }'
Great this gives number of recrods. Would it be possible to print the lines instead?
Thanks
You can put whatever you want it to do inside the braces.
Wrong one, ignore it. awk -F\| '{$1=$2=$NF=""}'1 urfile
awk -F\| ' !$1 || !$2 || !$NF { print $0 }'
That assigns an empty string to those fields; it doesn't tell whether they are empty.