extractcols.pl (Perl)

Program extracts any number of columns (and in any order) out of a machine readable table using the information in the metaheader. The program can be used to create a new table from the original machine-readable table that is Tab delimited and thus easily read into spreadsheet programs like EXCEL. The options flags that are currently available are:

  • -c#,#,#,…,# : which extracts out the columns numbers given after the -c flag. Each column number needs to be separated by a comma
  • -d(tab|amp) : specifies the type of delimiter used to seperate the columns. Use tab for a TAB delimiter and amp for &s
  • -latex : outputs the data in a LaTeX/AASTex style table.
  • -p : print out the metadata header only
  • -help : print this help message and quit.

The last arguement has to be the machine readable file.

The syntax is:

extractcols.pl -opt1 .... -opt# file


extractcols.pl -opt1 .... -opt# file > newfile

to capture the output to a file called newfile.

Program has been sucessufully compiled and tested with Perl v5.6.0 built for sun4-solaris running on a SUN Ultra 10. NOTE YOU MUST CHANGE THE FIRST LINE IN THIS CODE TO POINT TO THE LOCAL VERSION OF PERL ON YOUR MACHINE FOR THIS TO WORK!

Click here to download extractcols.pl