A scripting question

Walter Dnes waltdnes-SLHPyeZ9y/tg9hUCZPvPmw at public.gmane.org
Fri Feb 27 06:16:07 UTC 2004


  AWK, bash, sed, vim macro, perl, tr, whatever.  I have a remote inbox
with clss.net, which allows me to control smtp-stage blocking by DNSbl,
IP address, rDNS, etc.  I also get a log file.  I want to be able to re-
format the logfile for my own statistics.  Each reject causes 3 lines to
be written to the logfile;
  1) Originator + destination
  2) A TXT output, plus a message of my choosing.
  3) A zero-length line

  Here's an example.  Note that it does *NOT* really have the leading
"> "; that's just there to prevent linewrap in this message.

> Thu Feb 26 08:24:15 2004 (blaezilp-PkbjNfxxIARBDgjK7y7TUQ at public.gmane.org) -> (waltdnes at waltdnes.org) [62.195.50.109]
> Certain countries (pireject-tail) If yours was a legitimate email see http://www.waltdnes.org/bypass.html to bypass block.
> 
> Thu Feb 26 09:02:19 2004 (manko01-uAjRD0nVeow at public.gmane.org) -> (waltdnes at waltdnes.org) [65.83.117.101]
> Rejected due to lack of hostname. If yours was a legitimate email see http://www.waltdnes.org/bypass.html to bypass block.
> 
> Thu Feb 26 11:27:13 2004 (dchris8816-PkbjNfxxIARBDgjK7y7TUQ at public.gmane.org) -> (waltdnes at waltdnes.org) [67.153.220.90]
> Rejected email from dynamic IP. If yours was a legitimate email see http://www.waltdnes.org/bypass.html to bypass block.

  I can get rid of the blank lines with
grep -v "^..."

  And I can get rid of the pointer to my unfiltered email address with
sed "s/If yours was.*$//"

  This leaves me with...

> Thu Feb 26 08:24:15 2004 (blaezilp-PkbjNfxxIARBDgjK7y7TUQ at public.gmane.org) -> (waltdnes at waltdnes.org) [62.195.50.109]
> Certain countries (pireject-tail)
> Thu Feb 26 09:02:19 2004 (manko01-uAjRD0nVeow at public.gmane.org) -> (waltdnes at waltdnes.org) [65.83.117.101]
> Rejected due to lack of hostname.
> Thu Feb 26 11:27:13 2004 (dchris8816-PkbjNfxxIARBDgjK7y7TUQ at public.gmane.org) -> (waltdnes at waltdnes.org) [67.153.220.90]
> Rejected email from dynamic IP.

  I want to roll up the two lines for each reject into one long line
like so.  Again, the leading "> " isn't really there.

> Thu Feb 26 08:24:15 2004 (blaezilp-PkbjNfxxIARBDgjK7y7TUQ at public.gmane.org) -> (waltdnes at waltdnes.org) [62.195.50.109] Certain countries (pireject-tail)
> Thu Feb 26 09:02:19 2004 (manko01-uAjRD0nVeow at public.gmane.org) -> (waltdnes at waltdnes.org) [65.83.117.101] Rejected due to lack of hostname.
> Thu Feb 26 11:27:13 2004 (dchris8816-PkbjNfxxIARBDgjK7y7TUQ at public.gmane.org) -> (waltdnes at waltdnes.org) [67.153.220.90] Rejected email from dynamic IP.

  How do I remove every second end-of-line to achieve this ?

-- 
Walter Dnes <waltdnes-SLHPyeZ9y/tg9hUCZPvPmw at public.gmane.org>
Email users are divided into two classes;
1) Those who have effective spam-blocking
2) Those who wish they did
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list