View Single Post
Old 14th December 2008
J65nko J65nko is offline
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,779

The perl version is less incomprehensible as the sed one.
$ perl -n -e 's/^([^-]*)-(pkg.*)/mv $1-$2 $1_$2/; print;' tmp 
mv NOW/latest-pkg NOW/latest_pkg
mv NOW/latest-pkg-calyx NOW/latest_pkg-calyx
mv NOW/latest-pkg-erlangen NOW/latest_pkg-erlangen
mv NOW/latest-pkg-esat NOW/latest_pkg-esat
mv NOW/latest-pkg-plig NOW/latest_pkg-plig
mv NOW/latest-pkg-stacken NOW/latest_pkg-stacken
It is nearly identical to the incomprehensible regex for sed.

The differences
sed     perl
\(      (
\)      )
\1      $1
\2      $2
Less danger for the leaning toothpick syndrome
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote