Skip to content
TextArray
100% local

Extract lines

Pull out a line range, the first or last N lines, or every Nth line.

Input
Output

Extract lines

Pull exact lines out of any text by their line numbers — a range like 2-5, the first or last N lines, or every Nth line. Typical jobs: grabbing rows 100 to 200 from a long log, taking the header off a CSV export by keeping everything from line 2 on, sampling every 10th record from a data dump, or previewing just the first 20 lines of a file that is too big to skim.

In Range mode the field accepts flexible 1-based notation: a single number (3), a span (2-5), an open end (4- for everything from line 4 onward, -7 for everything up to line 7), and comma-separated combinations like 1,3,5-8. Parts that point past the end of the text are simply ignored, so 1-1000 on a 50-line file returns all 50 lines without complaint; only a spec the tool cannot read at all produces an error.

The other three modes use the N field instead. First N and Last N keep the head or tail of the text, and Every Nth keeps lines N, 2N, 3N and so on — every 2nd line, every 10th line. The Invert switch turns any selection into its opposite: instead of extracting lines 5-20 you delete them, and inverting First N strips a header block in one step.

Windows (CRLF) and Unix (LF) line endings are handled interchangeably, and the tally shows how many lines came in and how many went out. Everything runs locally in your browser — logs and exports never leave your device. Copy the result, download it as a .txt file, or send it to another tool for the next step.

FAQ

What forms does the range accept?
Single numbers (3), spans (2-5), open ends (4- for line 4 to the end, -7 for the start through line 7) and comma-separated combinations like 1,3,5-8. Line numbers start at 1.
What happens when the range goes past the last line?
Nothing bad — parts beyond the end are ignored. Asking for 1-1000 on a 50-line text simply returns all 50 lines.
Which line does "Every Nth line" start at?
At line N. With N set to 2 you get lines 2, 4, 6 and so on; with N set to 1 you get every line.
How do I delete a range instead of keeping it?
Turn on "Invert selection". The output then contains every line except the selected ones, so extracting 5-20 becomes deleting 5-20.
Is my text uploaded anywhere?
No. The tool runs entirely in your browser and your text never leaves your device.