Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display rows w/ more that 47 pipes(|).

Status
Not open for further replies.

chuckbranson

Programmer
Jan 27, 2005
2
US
Help Please,
I have a | delimited file that - unforunately - contains the delimiter in a one or two columns of a (very) few rows.
There are 47 fields so there should be 47 |.
I need to display the rows where there are more than 47 |.
The flat-file has 67M rows.
I've found 10 bad-rows in first 13M rows
Probalby ~20 to be found.
Help please.
Chuck
 
nawk -F'|' 'NF > 47' file

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
There are 47 fields so there should be 47 |.
Not 46 ?

a|b: two fields, one pipe

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
a|b| <-- 3 fields, 2 pipes

the OP has the hint - the rest is mechanics.

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
There is a terminating pipe - after the last field.

This file was built in a COBOL program. The output file format was hand-coded w/ the Pipe delimiters between all fields and after the last field.

Actually, when I ran w/ "> 47" I got All rows.

I changed to "> 48" and just got a few rows - where it is easy see the extra | in the address field. ??

Thanks to all.
 
is there a question there?

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top