Michael,

Thank you very much for your response and awk script.  Much obliged.

I am a complete newbie to awk (although I do have the Dougherty and
Robbins text on sed and awk on hand).  

When I execute awk with the script as you instruct, it creates an output
file that is unchanged from the input file.  I used the fully qualified
path for the awk command, awkscript.awk, input and output files.
However, I'm unable to get it to work.  

I'm running gnu awk 3.1.0, Red Hat 7.2. awk on my machine is a symbolic
link to gawk.

John

On 04/16/02, 05:26:44PM +0200, Michal 'hramrach' Suchanek wrote:
> On Sun, Apr 14, 2002 at 11:53:57AM -0400, John P Verel wrote:
> > David,
> > 
> > 
> > As suggested, here's the first two messages from the file.  The messages
> > bodies, which were just plain text, are omitted for confidentiality:
> > 
> > 
> > From:   Robert F. Hugi [[EMAIL PROTECTED]]
> > Sent:   Tuesday, November 02, 1999 11:20 AM
> > To:     Verel,John(NXI); [EMAIL PROTECTED]
> > Cc:     [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > Subject:        [Deleted]
> > 
> > >Message here, deleted
> > 
> > 
> > 
> > From:   Davis, Christopher [[EMAIL PROTECTED]]
> > Sent:   Wednesday, November 03, 1999 9:21 PM 
> > To:     Heyen,Keith A.(NXI); Verel,John(NXI)
> > Cc:     Goldstein,Irving V.; Chazaud, Diana; Taylor, Gabriella
> > Subject:      [Deleted] 
> > 
> > >Message here, deleted
> > 
> I made mutt read this mail as three-mail folder with awk:
> $ awk -f awkscript.awk <pst2 >output
> where pst2 is folder where I saved only the original (unquoted) mail and
> output is the rusulting folder. awkscript.awk is attached
> 
> 
> -- 
>       Michal Suchanek
>       [EMAIL PROTECTED]

> { if ($0 ~ "^From: ") {
>         # a From: line is eaten
>       from=$0
>       start=1
>  }else{
>         #not From:
>       if (start) {
>               #but after From:
>               start=0
>               if ($0 ~ "^Sent:") {
>                  # Sent: after From:
>                  mail=from;
>                  sub("^.*\\[","",mail);
>                  sub("\\].*$","",mail);
>                  wday=substr($2,1,3);
>                  mon=substr($3,1,3);
>                  mday=substr($4,1,2);
>                  year=$5
>                  hour=substr($6,1,2);
>                  min=substr($6,4,4);
>                  if ($7=="PM") hour+=12;
>                  date= "" wday " " mon " " mday " " hour ":" min " " year
>                  print "From " mail " " date
>                  print "Date: " date
>               } 
>                  #doesnt look like a header
>                  # just print the eaten line
>               print from
>       }
>          # not even after From:
>          # nothing special
>       print $0
>  }
> }


-- 
John P. Verel
Living Proof That Low Tech Beats High Tech!

Reply via email to