Reformat Java Sql

From EggeWiki
Revision as of 21:45, 11 December 2008 by Egge (talk | contribs) (New page: Occasionally, I come across a large multi-line SQL block inside Java code. The following sed one liner takes the code off from my clipboard, tidies it up, and puts it back in the clipboar...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Occasionally, I come across a large multi-line SQL block inside Java code. The following sed one liner takes the code off from my clipboard, tidies it up, and puts it back in the clipboard.

<geshi lang="bash"> sed -e 's/^[+"[:space:]]*//g; s/[[:space:]+"]*$//g' < /dev/clipboard > /tmp/$$; cp /tmp/$$ /dev/clipboard; /bin/rm /tmp/$$ </geshi>