Words & files

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.

Common every-Nth-line settings
Lines you wantIntervalStarting line
2, 4, 6, 8, ...22
1, 3, 5, 7, ...21
3, 6, 9, 12, ...33
2, 5, 8, 11, ...32
10, 20, 30, 40, ...1010

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.

  1. Paste the source text

    Each newline creates one row that can be counted by the extractor.

  2. Choose the interval and starting line

    Start 2 with an interval of 3 selects lines 2, 5, 8, 11, and so on.

  3. 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.