[Za-pm] Script

Bartho Saaiman bartho at cae.co.za
Wed Jun 4 08:54:22 CDT 2003


You got to love the power of the Internet :)

This works more than less for me for now, and I understand exactly why 
this might brake, so I will be careful.

I am also playing with Oskar's one liner, which is not pure perl anymore 
so suggestions for improvement is welcome. Note that it might apper wrapped:

[bartho at bartho]# perl -p -e '$_ =~ /^\[(.+)\] SMS .*\<(.+)\> \
	sent   (.+) characters to (.+)$/; $_ = "$1 $2 $3 $4\n";' < \
  	smslog |grep May|grep 2003  |awk '{if ($7=="bartho at cae.co.za") \
	{user=user+1; print $7 " " user}}'

bartho at cae.co.za 1
bartho at cae.co.za 2
bartho at cae.co.za 3
bartho at cae.co.za 4
bartho at cae.co.za 5
bartho at cae.co.za 6
bartho at cae.co.za 7
bartho at cae.co.za 8
bartho at cae.co.za 9
bartho at cae.co.za 10

Nick Cleaton wrote:
> On Wed, Jun 04, 2003 at 03:05:50PM +0200, Oskar Pearson wrote:
> 
>>So you basically want to discard the date and length and stuff,
>>and simply get the addresses?
>>
>>while (<STDIN>) {
>>        my ($email_address) = $_ =~ /([^\s<]+\@[^\s>]+)/;
>>        print "email_address: $email_address\n";
>>}
> 
> 
> That will go wrong on pathalogical cases like this:
> 
> [Sat May 24 12:51:37 SAST 2003] SMS "Mr Br@@i Dude" <braaidude at hotmail.com> sent 151 characters to 271234567891
> 
> --
> Nick

-- 
# Bartho Saaiman
# Stellenbosch Automotive Engineering
# Tel :: 27 21 882 8820 x 215
# Cell :: 27 82 551 2703
# Email :: bartho @ cae.co.za
# GnuPG Key is available at http://www.cae.co.za/people/bartho





More information about the Za-pm mailing list