Link to home
Start Free TrialLog in
Avatar of khuff71
khuff71Flag for United States of America

asked on

AIX script to parse records inside a file

I need to write an AIX script to parse the records inside the file /var/log/mail.log.  Here are a few records from the log.

Aug  1 13:51:33 domain sendmail[37804]: NAA99708: to=user@domain2.com, ctladdr=fr
ank (205/1), delay=00:00:01, xdelay=00:00:00, mailer=relay, relay=mail.domain.co
m. [::ffff:192.168.25.3], stat=Sent (2.6.0  <200708011851.NAA99708@domain.domain
.com> Queued mail for delivery)
Aug  1 13:51:34 domain sendmail[91206]: NAA56130: to=user@domain2.com, ctladdr=f
rank (205/1), delay=00:00:01, xdelay=00:00:01, mailer=relay, relay=mail.domain.c
om. [::ffff:192.168.25.3], stat=Sent (2.6.0  <200708011851.NAA56130@domain.domain.com> Queued mail for delivery)
Aug  1 13:51:34 domain sendmail[99712]: NAA74982: to=user@domain2.com, ctladdr=fr
ank (205/1), delay=00:00:01, xdelay=00:00:01, mailer=relay, relay=mail.domain.co
m. [::ffff:192.168.25.3], stat=Sent (2.6.0  <200708011851.NAA74982@domain.domain.com> Queued mail for delivery)

What I want out of it is:
Aug  1      13:51:34        to=user@domain2.com      <200708011851.NAA74982@domain.domain.com>

Can anyone help?  I do not know where to begin.  I am a novice at AIX scripts.
ASKER CERTIFIED SOLUTION
Avatar of amit_g
amit_g
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of khuff71

ASKER

That did it.  Now I need to be able to print only yesterday's date.  Can you help with that?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial