SQL string formatter

Is there a program, a utility, or some programmatic library, preferably for Linux, that takes an unformatted SQL string and pretty prints it? For example, I would like the following select * from u...