Remove Lines (CRT)
Chop lines off your prompt lists without editing by hand
- text
The fastest way to waste an afternoon in ComfyUI is pasting a 200-line prompt file into a node and hand-deleting the lines you don't want. Remove Lines (CRT) is the tiny utility that fixes that: give it a block of text and it chops a set number of lines off the top, the bottom, or both, and hands you back the clean result.
It lives in the CRT/Text corner of the CRT-Nodes suite, which is the text-tooling drawer of this pack. If you batch-generate from prompt files - the CRT pack is built for that, with its crawl loaders, string batchers, and batch samplers - this is one of the quiet little nodes that makes the loop not miserable.
How it works
It's a pure string operation, which means it's instant and has nothing to do with your GPU. The text is split into lines, then three things happen in order:
remove_empty_linesstrips blank or whitespace-only lines first, if you want that.early_linesslices that many lines off the front.last_linesslices that many off the end.
Then the survivors are rejoined with newlines and passed out as a single text string. That ordering matters: if you're trimming both ends, the empty-line cleanup happens before the slicing, so the counts you set refer to non-empty lines.
The four inputs are text, early_lines, last_lines, and remove_empty_lines. That's the whole surface area. The one output, text, wires straight into anything that eats a string - a conditioning encode, a String Batcher, a save node, whatever.
When you'd actually reach for it
Three cases come up constantly. You've got a list of prompts where the first few lines are headers or notes you don't want sampled - set early_lines to skip them. You're mid-way through a long batch and don't want to re-run the first N prompts - same knob, and it keeps your seed-to-image mapping stable because the file never changes. Or your text loader pulled in trailing junk (blank lines, a stray footer) and you want a clean string before it hits anything else.
It's also the honest answer to "how do I collapse a list of trigger words into one line": enable remove_empty_lines, slice, done.
Install and troubleshooting
It's part of CRT-Nodes, so it installs with the whole pack - ComfyUI Manager, search "CRT-Nodes", install and restart, or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/PGCRT/CRT-Nodes.git
pip install -r requirements.txt
No per-node dependencies here; the pack's heavy requirements (opencv, spandrel, pedalboard, whisper, transformers…) are loaded for other nodes and don't matter for this one.
Honestly, there's no troubleshooting section worth writing. It's a deterministic text transform - the only "failure" is passing an empty string, which returns an empty string. If your output looks wrong, check that you didn't set last_lines high enough to eat the whole list, and remember it counts lines, not characters. When last_lines exceeds the line count, you get an empty string back, not an error - which can look like the node ate your prompts when really it just trimmed harder than you meant.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| early_lines | INT | 00–9999 | — |
| last_lines | INT | 00–9999 | — |
| remove_empty_lines | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |