on Sat, Nov 15, 2003 at 07:54:25PM +0000, Pigeon ([EMAIL PROTECTED]) wrote: > On Sat, Nov 15, 2003 at 06:03:06AM -0800, Karsten M. Self wrote: > > I've prepared a couple of scripts which I'm using to report swen headers > > and body to originating ISPs. > > > > - Scripts work on directory-based mail folders (Maildir, MH, etc.). > > *NOT* mbox. Sorry. > > Pipe the mbox into this quick and clunky mbox-splitter: > > #!/bin/bash > IFS=$'\n' > i=0 > BASENAME="split.mbox" > while read x; do > echo "$x" | grep '^From ' && i=$(( i + 1 )) > echo "$x" >> $BASENAME.$i > done
Cool. I've revised the fqdn2domain script for more accurate operation. Essentially: it now identifies fqdns which already are in domain form, and outputs these unchanged. Attached. Peace. -- Karsten M. Self <[EMAIL PROTECTED]> http://kmself.home.netcom.com/ What Part of "Gestalt" don't you understand? What doesn't kill you makes you stranger. -- Karsten M. Self, misreading as usual, San Marcos Pass Rd., 1988
#!/bin/sed -nf # This should be named 'getTLD.sed'. It's a script to trim an FQDN to # just the appropriate registered domain. Useful in filing, say, # complaints to [EMAIL PROTECTED] and [EMAIL PROTECTED] addresses. # Exceptions. Domains generally in RFC ignorant. Specific mappins s/^.*wanadoo\.fr$/francetelecom.com/ # ---------------------------------------------------------------------- # Already a domain: /^[^.]\{1,\}\.[^.]\{2,\}$/{ p d } # "Standard - nationalized": net|com|edu|gov.<country-TLD> style: /\.\(net\|com\|edu\|mil\|gov\)\.\(ae\|ar\|au\|br\|cn\|do\|il\|mx\|my\|np\|nz\|ph\|pk\|pl\|sg\|tr\|tw\|ua\)$/ { /^.*\.\([^.]\{1,\}\.[^.]\{1,\}\.[^.]\{1,\}\)$/s//\1/p d } # "Commonweath" (ac|co|ne).<country-TLD> style: /\.\(ac\|co\|ne\)\.\(nz\|th\|uk\|za\)$/ { /^.*\.\([^.]\{1,\}\.[^.]\{1,\}\.[^.]\{1,\}\)$/s//\1/p d } # Japan /\.\(ac\|ad\|co\|ed\|go\|gr\|ne\|or\|geo\)\.\(jp\)$/ { /^.*\.\([^.]\{1,\}\.[^.]\{1,\}\.[^.]\{1,\}\)$/s//\1/p d } # State/province + country # Canada /\.\(ab\|bc\|mb\|nb\|nl\|ns\|nt\|nu\|on\|pe\|qc\|sk\|yt\)\.\(ca\)$/ { /^.*\.\([^.]\{1,\}\.[^.]\{1,\}\.[^.]\{1,\}\)$/s//\1/p d } # United States of America /\.\(ak\|al\|ar\|as\|az\|ca\|co\|ct\|dc\|de\|fl\|ga\|gu\|hi\|ia\|id\|il\|in\|ks\|ky\|la\|ma\|md\|me\|mi\|mn\|mo\|mp\|ms\|mt\|nc\|nd\|ne\|nh\|nj\|nm\|nv\|ny\|oh\|ok\|or\|pa\|pr\|ri\|sc\|sd\|tn\|tx\|um\|ut\|va\|vi\|vt\|wa\|wi\|wv\|wy\)\.\(us\)$/ { /^.*\.\([^.]\{1,\}\.[^.]\{1,\}\.[^.]\{1,\}\)$/s//\1/p d } # Other/default (usually: com|org|edu|mil|gov /^.*\.\([^.]\{1,\}\.[^.]\{1,\}\)$/s//\1/p
pgp00000.pgp
Description: PGP signature