Skip to content

Instantly share code, notes, and snippets.

@evandrix
Created July 15, 2011 15:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evandrix/1084944 to your computer and use it in GitHub Desktop.
Save evandrix/1084944 to your computer and use it in GitHub Desktop.
Perls of wisdom
# Add line numbers to file
cat file | perl -wne 'while (<STDIN>) { print "$. $_" }'
# Add '!' prefix for WikiFormatting of classnames
# pattern:
# - 2 or more capital letters
# - no consecutive capital letters
# or use {{{ ... }}} for preformatted code block
cat file | grep -v "^\s*$" | sed -e "s/$/ [[br]]/g" | perl -wne '$_ =~ s/(?!\w*[A-Z]{2,}\w*)((?<!")[A-Z]\w+[A-Z]\w+)/!$1/g; print;'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment