On Sun, Sep 25, 2011 at 3:27 PM, erik <ejans...@itmatters.nl> wrote: > Hi Don, > > I didn't attach the script (knowingly) to the 'I think good news' > posting on vim_dev. I sent it by e-mail directly to you and Zvezdan. > That's the one to use. > > I keep my fingers crossed
It works on the example I gave you, but it does not work on this (which was indented by the R indenter): file != previous_file && previous_file in create_pivoted_postamble { # Finish up field we just worked on if (previous_field != "") { periods_per_field[previous_field] = N if (N > max_N) max_N = N } # Create print "," > "create_pivoted.sql" print create_pivoted_postamble[previous_file] > "create_pivoted.sql" # Load for (i=1; i<max_N; i++) { printf "%s)\nselect\n%s", insert, sprintf(load_pivoted_select_preamble[previous_file],i) > "load_pivoted.sql" for (j=1; j<M; j++) if (i<periods_per_field[fields[j]]) printf ",\n\t%s", field_to_SI_field[fields[j],i] > "load_pivoted.sql" else printf ",\n\t%s", "NULL" > "load_pivoted.sql" printf "\n%s\n", sprintf(load_pivoted_postamble[previous_file],i) > "load_pivoted.sql" } # Duplicate elimination print ";\n" > "duplicate_elimination_pivoted.sql" } Running the new awk indenter produces: file != previous_file && previous_file in create_pivoted_postamble { # Finish up field we just worked on if (previous_field != "") { periods_per_field[previous_field] = N if (N > max_N) max_N = N } # Create print "," > "create_pivoted.sql" print create_pivoted_postamble[previous_file] > "create_pivoted.sql" # Load for (i=1; i<max_N; i++) { printf "%s)\nselect\n%s", insert, sprintf(load_pivoted_select_preamble[previous_file],i) > "load_pivoted.sql" for (j=1; j<M; j++) if (i<periods_per_field[fields[j]]) printf ",\n\t%s", field_to_SI_field[fields[j],i] > "load_pivoted.sql" else printf ",\n\t%s", "NULL" > "load_pivoted.sql" printf "\n%s\n", sprintf(load_pivoted_postamble[previous_file],i) > "load_pivoted.sql" } # Duplicate elimination print ";\n" > "duplicate_elimination_pivoted.sql" } > > Erik. > > -- > You received this message from the "vim_dev" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php