Text Column Extractor
Take just the columns you need from CSV, TSV, log lines or any delimited text. Pick columns by position, as single numbers, lists or ranges, count from the end with negative numbers, and choose the delimiter for the result. Quoted CSV fields that contain the delimiter are handled correctly.
Extract Columns from Delimited Text
Extracted columns
Summary
How to Use the Text Column Extractor
- Paste your delimited text.
- Enter the columns you want, such as 2 or 1,3 or 2-4, or -1 for the last column.
- Choose the input delimiter (or leave it on automatic) and the output delimiter.
- Copy or download the extracted columns.
About This Tool
Analysts trimming exports before pasting them elsewhere, developers grabbing one field from log or config lines, and anyone who would otherwise use cut or awk on the command line.
Input: Delimited text · Output: Delimited text.
Features and Limitations
Features
- Lists, ranges and negative positions, in any order you choose (3,1 swaps columns).
- Automatic detection of comma, tab, semicolon and pipe.
- CSV-aware parsing of quoted fields, with re-quoting in the output when needed.
- Whitespace mode splits on any run of spaces, like awk.
Limitations
- Rows with fewer columns produce empty values for the missing positions.
- Columns are chosen by position, not by header name.
- With quote handling on, a stray unmatched quote can merge the rest of the text into one field; turn the option off for non-CSV text.
- Results are computed in your browser; nothing you enter is sent to a server.
Example
From “id,name,city / 1,Ana,Lisbon / 2,Ben,Leeds”, columns 2,3 give “name,city / Ana,Lisbon / Ben,Leeds”.
Frequently Asked Questions
How do I get the last column when rows have different lengths?
Use -1. Negative numbers count from the end of each row, so -1 is always the last value.
Can I reorder columns?
Yes. Columns are output in the order you list them, so 3,1 puts the third column first.
How are quoted values with commas handled?
With CSV rules on, "Lisbon, PT" stays one field. In the output it is quoted again if it contains the output delimiter.
Can I extract by column name?
Not directly. Look at the header row to find the column's position and enter that number.
Related Tools
More like this: all Transform & Compare tools, all Text & Writing tools or the TinySandy home page.