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!

awk error "has too many fields"

Status
Not open for further replies.

Dorga

MIS
Jul 30, 2003
101
NZ
I am having a problem solving this, the data fields in the file can be quite long and some are too long for awk to deal with. Looking for ideas.. I do not need to use awk, I just didnt know any other solution. All records in the data file are comma delimited.

awk -F"," '{print $15}' < blah

awk: record `3147879,0,3,0,SMS_he...' has too many fields
record number 103
Broken Pipe
 
Take a look at the cut command.
Lot of awk flavors are limited to 100 fields.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
One way to do it is to write a function that splits [tt]$0[/tt] into an array and returns the nth field:
Code:
BEGIN { FS="^.*$" ; xFS="," }
{ print f(15) }

function f( n,    a )
{ split( $0, a, xFS )
  return a[n]
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top