Text column slicer
Slice text by a list of column ranges such as 1-10,20-30, with multiple ranges, merged overlaps, code-point counting and optional skipping of short lines. Everything runs locally.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
For example 1-10,20-30 means columns 1-10 plus columns 20-30; a single column is 5, and 12- runs to the end of the line. Overlapping ranges are merged.
Columns are counted in Unicode code points (not bytes) and start at 1. Paste text directly or read a local TXT file with the button below.
Sliced result
Every line is sliced by code point and then joined; line endings are normalised to LF (\n).
Enter text to slice it by columns
What this tool does
- Extract a few segments from fixed-width logs or reports, for example keep only the timestamp and the level
- Drop fixed column positions such as line numbers from every line while keeping the rest untouched
Example
Input
1001 张三 开发部 1002 李四 测试部 1003 王五 市场部
Output
1001开发部 1002测试部 1003市场部
Ranges 1-4,11- keep columns 1-4 (the id) and everything from column 11 (the department); the two skipped spaces are dropped.
Frequently asked questions
How is this different from the "cut by column" tool?
This tool works with a **list of column ranges**: 1-10,20-30 keeps columns 1-10 and 20-30, concatenated in position order, with overlapping or adjacent ranges merged (1-10,5-20 becomes 1-20). The "column cutter" works with a **width table**: 10,12,8 splits a line into three fixed-width columns and then outputs one of them or all of them joined by a separator. Use this one to keep several slices, use that one to split fixed-width fields.
How are columns counted? Can Chinese characters break the count?
Columns are counted in Unicode code points, not bytes. One Chinese character or one emoji with a single code point counts as one column; columns start at 1 and both bounds are inclusive. Astral characters are handled through a code-point array, so a surrogate pair is never cut in half even though JS length would count it as 2.
What happens when a line is shorter than the requested columns?
By default the available part is kept and no error is raised (a line with 8 columns and a range starting at 20 yields an empty line). With "skip lines whose columns all fall past the end" enabled those lines are dropped and counted as skipped.
Is my file modified? Are line endings changed?
The original file is never written back: the result is shown on the page and can be copied or downloaded as a new TXT. CRLF / CR / LF input is normalised to LF (\n) in the output, so a Windows file comes back with Unix line endings.
Keywords:text column slicercut columnstxt-cols-cut