Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^2: [off-site] Bash + Perl oneliners basics

by Anonymous Monk
on Mar 17, 2005 at 09:50 UTC ( #440318=note: print w/ replies, xml ) Need Help??

in reply to Re: [off-site] Bash + Perl oneliners basics
in thread [off-site] Bash + Perl oneliners basics

I bet mine runs with 1/4th the CPU.
Except that for small to medium sized files, it doesn't matter and the additional programming (and debugging) time dwarves the running time. And for really long files, your program might actually be slower, or even fail to finish as it will consume significant amounts of memory. The elegant one-liner, consisting of several tools that do one thing well won't suffer from memory problems, as 'sort' knows when to switch to using temporary files.

Having said that, I would have written the one-liner as:

awk '{print $6}' /var/log/httpd/access_log | sort | uniq -c | sort -n | head -10

Comment on Re^2: [off-site] Bash + Perl oneliners basics
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://440318]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2015-10-09 12:53 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (242 votes), past polls