Extract CSV column

Extract CSV column

Description

Extract all entries from a user-specified column in the given CSV input files.

Entries may be sorted and converted to uppercase. Duplicates can be removed, and the results can be written to a text file.

Input files

  • at least 1 input file (.csv)

Output files

  • Entries (entries.txt)

Context



Example

Using the following table as the input:

Column AColumn B
1A
2B
3C
4B
5B

...the following file is created by default (assuming that 'Column B' is specified as the column):

A
B
C
B
B

With sorting enabled, the following file is written:

A
B
B
B
C

With sorting and removing of duplicates enabled, the following file is written:

A
B
C

Common CSV file problems

CSV files must be plain text files, using  ,  as the entry separator, and  "  as the optional quote character. The quote character is used to denote a cell if the entry separator is part of the cell content. The first line is expected to represent the table header, all following lines are expected to represent table rows.

Parameters

Column

Default: peptide

Upcase entries

Default: false

Sort entries

Default: false

Remove duplicates

Default: false

Source code

extract-csv-column.rb, extract-csv-column.yaml (GitHub)