I’ve inherited a few dozen sql scripts that look like this:
select
column_a,
column_b,
column_c
from
my_table
To format them so they match the rest of our sql library, I’d like to change them to look like this:
select
column_a
,column_b
,column_c
from
my_table
where the commas start at the beginning of the line instead of at the end. I’ve taken a few passes at this in Perl, but haven’t been able to get it to work just right.
Can any of you Perl gods provide some enlightenment here?
The character class is any non-newline whitespace.
-0777 causes it to operate on whole files, not lines.