20101028

Rename files with spaces to dash

find . -maxdepth 1 -type f | rename 's/ /-/g'

20100529

PERL: Install all prerequisites

cpan> o conf prerequisites_policy follow
cpan> o conf commit

20100318

Removing leading zero using awk

Had to extract data from rrdtool and feed it to Zabbix. Problem was I kept getting leading zero variables. This removes any leading zero:

rrdtool fetch lighttpd.rrd AVERAGE -s -60s \
| grep -v nan \
| grep -v Requests \
| awk '{printf "%d",$2}' \
| awk '{print $1 + 0}'

to test it yourself:

echo 000000105 | awk '{ print $1 + 0}'