Page 1 of 1

unix command to see these incomplete records

Posted: Thu May 17, 2007 10:24 am
by Hope
The unix command to see the incomplete records.
awk -F"\t" '{if (NF != 13) print NR,NF,$0}' filename.txt|more

This is good for txt files.
But what is the command for zipfile.
filename.gz(format)

Could any one please help.

Posted: Thu May 17, 2007 10:28 am
by chulett
You'll have to gunzip the file and pipe the output to awk.

Posted: Thu May 17, 2007 10:39 am
by Hope
gunzip -c file.gz |awk '{print $1}'|more

I am not sure if I am using it right or not. When I use this command it says file is too large

Posted: Thu May 17, 2007 4:27 pm
by ray.wurlod
Then it's too large. It may be too large for more (you could experiment). Otherwise you need to unzip to disk and run awk over that. Use redirection operators - you could add an rm command to the end of the pipeline of commands.

Posted: Fri May 18, 2007 10:50 am
by Hope
gunzip -c file.gz | awk -F"\t" '{if (NF != columncount ) print NR,NF,$0}'


This command worked for the large files too. I did close the Unix box and re-opened and used the command again it did work.

Thanks for your help