Saturday, October 9, 2010

Perl one-liner, bumping a version string

This takes a version string like "1.23f" and turns it into "1.23g" (or adds "a" if there's no trailing letter):

perl -lpe 's/([^a-z])$/$1a/ || substr($_, -1) =~ tr/a-z/b-za/'