in reply to Perl vs. Shell Script
I think that knowing at least a little of some shell, sed and awk with perl reveals itself quite useful. You can do with perl everything you would do in the shell, I believe, but somethimes using the shell alone or coupling it with perl makes things simpler and/or faster. I'll try to show that with a few examples.
Whatching a log running, removing some unuseful lines and cleaning up others: here I prefer the shell, with tail and sed:
tail -f /logs/mail.log | sed -e '/last message repeated/d' -e 's/messa +ge forwarded from myhost: //i'
In a multiple-machine syslog, show only messages coming from a single host: awk can do the trick easily:
tail -f /logs/mail.log | awk '$4~/host/ { print }'
Read output from uptime and play a sound if load level in the last 5 seconds is lower than 0.4: here you can make the shell (bash) play with perl:
(while true ; do uptime ; sleep 3 ; done) | perl -ne '@load = /\d\.\d +\d/g ; print "\a" if $load[0] < .4 ; print "@load\n"'
but you could easily do the same using perl alone and backticks.
Summing up: you can make it knowing just perl, but knowing a good perl with a little of a shell and some basics of common unix tools can make your life easier.
My 2 cents (of Euro :-)
--bronto
|
|---|