Textmate command #0
Here’s my first pass at a Textmate command (for the E text editor). It copies the text selection to a multi-line C constant, useful for pasting SQL statements into C code:
perl -p -e 's/^(\s+|)(.*)( |)(\s+|)$/$1\"$2$3\"$4/' | pbcopy
echo "Copied C-SQL to Clipboard"
The regex preserves whitespace after each line of statement within the quotes, and preserves the indent so you can still read the SQL in your C code.

RSS