piapia123
en

Column Extract

Text

Everything runs locally in your browser — nothing is uploaded

Input
Drop a file here to load its contents
Output

Pull the pieces you want out of every line. There are two kinds of “column”, so there are two modes: By delimiter — a line is one record and each piece between delimiters is a column. This is for CSV, logs and data shaped like `name,phone,address`. By character position — a line is a string of characters and you want, say, characters 5 through 12. This is for fixed-width text, legacy fixed fields, and “keep only the first 20 characters of each line”. Merged into one mode, the phrase “column 2” would mean different things on different data and you could not say which one you meant. Negative indexes count per line. `-1` is that line’s last item — with ragged data (some lines with three columns, some with five) that is the only way to say “the last one”. Items you cannot reach produce an empty string rather than an error: failing the whole batch over one odd line is too harsh, and the Drop rows option lets you decide whether those lines stay as placeholders or go.

Features

  • Two modes: split by a delimiter, or slice by character position
  • Column specs like `2`, `2-4` and `1,3,5-7`, separated by commas or spaces
  • Negative indexes count from the end, resolved per line so ragged data still works
  • Delimiters can be escaped (`\t`) or multi-character (such as `::`)
  • Unreachable items stay empty so line counts still line up, or drop them outright
  • Position mode counts grapheme clusters, so an emoji is one position
  • An unreadable column spec raises an error instead of returning an empty result
  • Everything runs locally in your browser; nothing is uploaded

How to use

  1. Paste the data, one record per line
  2. Choose delimiter mode or character position
  3. Fill in which columns you want, such as `2` or `2-4`
  4. Click Copy to take the result

FAQ

Why does `2 - 4` raise an error?
Because commas and spaces both separate column specs, so `2 - 4` splits into three tokens: `2`, `-` and `4`, and `-` is unreadable. A range cannot contain a space — write `2-4`. Raising an error is deliberate: a silently wrong column produces output that looks perfectly fine, and you would only notice when you use the data.
Why do some lines come out empty?
Because that line does not have the column you asked for — for instance, two columns of data when you asked for the third. That is by design: unreachable items stay empty and the line count matches the input, so you can line the result up against the original. Tick Drop rows that came out empty to make them disappear instead.
How do negative indexes count?
`-1` is the last item on that line and `-2` the one before it. The important part is that it is resolved per line: given three lines with five, three and four columns, `-1` gives each line’s own last item. That is why the spec has to be parsed per line rather than once for the whole text. Negatives combine with ranges too: `-3--1` takes the last three items.

Related tools