Line Processing
Batch add prefix/suffix and line numbers; remove or keep lines containing keywords
Batch line processing: prefixes, suffixes, line numbers, and keyword filtering
Five actions run in a fixed order
One run of this tool applies changes in this exact sequence: filter by keyword first, then add prefix and suffix, and finally add line numbers. The order is not cosmetic — it changes what you get back:
- Line numbers come after filtering. So the number you see is "which row in the result set", not "which row in the original text". This matters when you quote code: if you need the original line numbers preserved, do not filter here, because re-mapping filtered output back to the source wastes time.
1.and similar numbering is assigned to the post-filter rows. - Prefix and suffix come before line numbers. The generated number is appended after the prefix and before the content. If your prefix is
1., the output shape is driven by how you combine the three inputs, but the numeric label always lands after the prefix you supplied.
The point is that filtering reshapes the list, and numbering reflects the reshaped list. Keep that in mind whenever the output is going to be cited elsewhere.
How keyword filtering actually works
Both filter boxes are substring includes matches — not regular expressions, not whole-line matches — and they are case-sensitive. A few practical judgments:
| Goal | Keyword | Note |
|---|---|---|
| Keep only error lines | keep containing ERROR | All-caps log levels are usually reliable |
| Drop comment lines | remove containing # | Inline comments are also dropped, because this is substring matching |
| Drop blank lines | remove containing (a single space) | Unreliable: a blank line made only of tabs will not match; use the empty-line toggle in the dedupe tool instead |
| Drop a specific word | remove containing that word | Substring matching means cat also hits category |
The last two rows show the classic trap of substring matching. The shorter the keyword, the more false hits you get. After filtering, scan the result once before trusting it — discovering missing data afterwards is far more expensive than a quick glance.
If both filter boxes are filled, deletion runs first and keeping runs second. The sensible pattern is "delete the obviously irrelevant bulk first, then keep what you care about".
Typical uses for prefix and suffix
- Generate list markers. A prefix of
-yields a Markdown unordered list. - Build an SQL IN list. A prefix of
'and a suffix of',produces a run of quoted literals. Note the last line keeps a trailing comma, which you must handle by hand or by processing the final line separately. - Build a string array for code. A prefix of
"and a suffix of",generates several lines at once. - Quote values into a CSV column. Combine with line processing to produce
"value"before pasting into a spreadsheet. - Add a comment prefix. A prefix of
//comments out a whole block of text at once.
Safety note when generating SQL or code: literals built this way are fine for local data wrangling and one-off scripts. Never concatenate user input into SQL this way and then execute it — that is the textbook SQL injection entry point. In real programs, values must go through parameterized queries (placeholders), never string concatenation.
How this tool relates to its neighbours
| Need | Use |
|---|---|
| Add prefix/suffix/line numbers, filter by keyword | This tool |
| Remove duplicate rows, sort | Line dedupe and sort |
| Replace text by pattern | Find and replace |
| Strip leading/trailing whitespace, normalize newlines | Whitespace cleaner |
How to use it
Paste one item per line, fill the prefix, suffix, and keywords as needed, tick "add line numbers", and click process. Everything runs locally in your browser — logs and configs routinely contain tokens, internal addresses, and user data, so local processing is a necessary default, not a nice-to-have.
If the log is huge, shrink the scope with a keyword first rather than pasting hundreds of thousands of lines into the browser.
FAQ
Can remove and keep be used together?
Yes. First filter out unwanted lines by "Remove containing", then further filter by "Keep only containing"; the two stack.
Are line numbers based on pre- or post-processing order?
Line numbers are assigned based on the current line order after filtering and adding prefix/suffix, matching the final output.