awk question

awk question

Post by John Hunt » Thu, 18 Dec 1997 04:00:00



I am writing an awk script that parses a very large file of emails
from a variety of different people.  The error that I run into is that
for some entries there are too many fields or records.  I've tried a
variety of field and record separators, but none have worked in every
case; some solve the field problem but generate records that are too long.

Some of the emails have uuencoded binaries attached and some have long
paragraphs with no new lines.  I looked through the man pages and the
O'Reilly book but have found no reference to a maximum number of
fields or records or record size, but apparently they exist.  

Questions:
1) What are these limits?
2) How can I circumvent them?
3) Should I be doing this another way?

Thanks for the advice (example command and output below),
John Hunter

Here is an example command

awk '$1=="^From" {print $2}' myfile

that generates the output and error
whatup?>awk '$1=="^From" {print $2}' myfile









awk: record `Thank you for your l...' has too many fields
 record number 292
--------------------------------------------------------
John D. Hunter
University of Chicago                   h:(773) 288-3970

 
 
 

1. Simple awk question

I am trying to build on an example in the O'Reilly book on 'sed'
and 'awk', but not getting anywhere. The example is the script
'filesum' starting on page 160.

Even the following script fails:

=====

#!/bin/csh -f

ls -l $* | nawk '{   \
           BEGIN { print "BYTES" } ;  \
               {  sum += $5 ;  \
                  ++filenum ;  \
                  print $5  }    \
           }'
======

even though it works without the BEGIN line. I have very
limited experience with 'awk' (just simple one liners').
Checking various websites did not help. Any pointers
on where to look up on the use of 'awk' within C shell
scripts would be welcome.

thanks

--


                         Remove 'bounceback' for email address

2. shell interpreter

3. Awk Question - Again

4. FreeBSD and Linux goes together

5. SED & AWK Question...

6. lm_sensors and fan speed control

7. sed/awk question

8. Making enlightenment the default window manager

9. awk question

10. awk question: getline with no argument

11. awk question

12. HELP: awk question

13. AWK Question???????