unix command to see these incomplete records

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
Hope
Participant
Posts: 97
Joined: Sun May 13, 2007 2:51 pm
Contact:

unix command to see these incomplete records

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You'll have to gunzip the file and pipe the output to awk.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Hope
Participant
Posts: 97
Joined: Sun May 13, 2007 2:51 pm
Contact:

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Hope
Participant
Posts: 97
Joined: Sun May 13, 2007 2:51 pm
Contact:

Post 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
Post Reply