User:Michael Bednarek/WTROC

This tool allows the re-ordering (and dropping) of columns of Wikipedia tables (WTROC= W ikipedia T ables R eorder C olumns). It requires the Microsoft Windows Script Host.

Instructions
Save the code below into a file and name it WTROC.WSF.

Save the Wikipedia table code you want to process into a file named as you wish. Add a new first line to that file which contains the original column numbers in the new order; columns can be dropped by using 0 (zero) as their new column designator; new columns can be inserted by entering a text string insted of the column number.

Invoke the program with WScript //Nologo WTROC.wsf "file.txt" >"output.txt".

The Wikipedia table code must specify each row in a single record. See the program code for an example.

The program performs no error checking; it is not comprehensively tested but it works for me. Report errors on this page's Talk page. Use at your own risk. Note especially that no check is performed whether the redirected output file already exists and whether you really want to overwrite it. I am unlikely to develop this any further, e.g. dealing with more freely formatted Wikipedia table code where line breaks are used to separate columns.