beating back the microsoftian hordes...

Andrew Savige ajsavige at yahoo.com.au
Wed Nov 19 05:41:47 CST 2003


peter renshaw wrote:
> was this before or after they (Gosling and Java engineers at Sun) tried 
> some regular expression hacks in competition with some Perl hackers?
> http://use.perl.org/articles/02/09/16/1448246.shtml?tid=35

A wise man once analysed this problem:

#!/bin/sh
egrep -v '\.(gif|GIF|jpg|JPG|css|CSS) HTTP|^192\.(9|18|29)\.' inf >e

#!/bin/sh
gawk '!/\.(gif|GIF|jpg|JPG|css|CSS) HTTP|^192\.(9|18|29)\./{print}' inf >a

#!/bin/sh
perl -ne'/^192\.(?:9|18|29)\./||/\.(?:gif|GIF|jpg|JPG|css|CSS) HTTP/ or
print' inf >p

Apart from being 100 times shorter than the given Java solution, all
three solutions are *much* faster (alas, egrep beat Perl for both golf
and speed on this one). But hey, the Java web site *still* claims that
Java beat Perl on this problem, so that must be right. ;-)

/-\


http://personals.yahoo.com.au - Yahoo! Personals
New people, new possibilities. FREE for a limited time.



More information about the Melbourne-pm mailing list