Pick lines in a pattern
Keep or remove every 2nd, 3rd, or other line
Keep or remove every second, fifth, tenth, or other repeating line.
Free browser tool
Choose which repeating lines to use
Paste lines, then choose which repeated lines to keep or remove.
Processed in your browser
Copy or download the result
No account. No signup.
Pattern reference
Common every-Nth-line settings
Use the interval for the repeating distance and the starting line for the first match.
| Lines you want | Interval | Starting line |
|---|---|---|
| 2, 4, 6, 8, ... | 2 | 2 |
| 1, 3, 5, 7, ... | 2 | 1 |
| 3, 6, 9, 12, ... | 3 | 3 |
| 2, 5, 8, 11, ... | 3 | 2 |
| 10, 20, 30, 40, ... | 10 | 10 |
When Count blank lines is off, blank rows are skipped before positions are counted. The output still keeps the selected nonblank lines in their original order.
Optional guide Learn more about this tool Open the full explanation and detailed steps.
How repeating line extraction works
A line is selected when its counted position equals the starting line plus a whole multiple of the interval: selected line = start + (k x interval), beginning with k = 0.
Paste the source text
Each newline creates one row that can be counted by the extractor.
Choose the interval and starting line
Start 2 with an interval of 3 selects lines 2, 5, 8, 11, and so on.
Keep or remove the matches
Keep only the selected lines or delete them. Decide whether blank rows occupy a counted position before relying on row numbers.
Quick example
Keep every third row
The example keeps every third row: rows 3, 6, and 9.
Common questions
Keep every 2nd, 3rd, or 4th line FAQ
How do I keep the even-numbered lines?
Set Repeat every how many lines to 2 and First line to pick to 2.
How do I keep the odd-numbered lines?
Set the interval to 2 and the starting line to 1, which selects lines 1, 3, 5, and so on.
Can I remove every tenth line instead of keeping it?
Yes. Set Repeat every how many lines to 10, choose the first matching line, and select Remove the picked lines.
Are large logs uploaded for processing?
No. The filtering happens in your browser and supports up to one million pasted characters.