提取特定行🐠meeeyo.com
Pull exact lines out of a block by position — with a bonus combined output
- STRING
- STRING
- STRING
- STRING
- STRING
- STRING
ExtractSpecificLines plucks named lines out of a text block by their position and hands them to you individually. If you keep structured text in a node - a template where line 1 is the subject, line 2 the style, line 3 the lighting - this node turns "that structured block" into separate, wireable strings, plus a combined version you can feed straight to a prompt.
It's part of MeeeyoAI/ComfyUI_StringOps, and like the pack's other line tools it's small, deterministic, and aimed at people who organize prompts as multi-line blocks rather than one long string.
The inputs
- input_text - the multiline block to pull from.
- line_indices - which lines, separated by
|. Default1|2- and note the indexing is 1-based (line 1 is the first line), which matches what humans expect and what the pack's other index nodes use. - split_char - the delimiter lines are split on, default
\n(newline). Set it to something else - a comma, a tab - and the node splits on that instead, which turns a comma-separated list into "lines" too.
The outputs
Six STRINGs, which looks like a lot for such a small node:
- Five outputs, one per requested line - out-of-range or missing lines come back as empty strings, and the list pads to five, so the ports always have values.
- A sixth, combined output that joins the non-empty results with the same
split_charyou split on.
The practical payoff: wire lines 1–3 into three separate CLIP text encoders for different conditioning branches, or take just the combined output and treat it as "the clean version of this block."
The gotchas
Indexing is 1-based but out-of-range requests fail quietly - ask for line 9 of a 4-line block and you get empty strings, not an error. That's fine when you expect it, confusing when you don't. Also, the split is naive: with a default newline split, a line containing a literal newline can't exist, and empty lines in the middle of the block will occupy an index slot like any other. If your block has blank lines, they shift everything below them down by one - a classic off-by-one trap.
For the pack, it's the "select by index" sibling of ExtractAndCombineLines (which re-joins instead of splitting apart) and FilterLinesBySubstrings (which filters by content, not position). If you know the structure of your text, this is the precise one.
Installing
Standard pack install:
cd ComfyUI/custom_nodes
git clone https://github.com/MeeeyoAI/ComfyUI_StringOps.git
or Manager, searching ComfyUI_StringOps, then restart. Under "Meeeyo/String" in the menu. No models, light dependencies - it's pure Python string work, instant to run.
It's a specialist tool. But if you organize prompt templates as fixed-layout blocks - and a lot of workflow authors do, because it's readable - this is the node that makes the layout machine-readable without writing a line of code.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| input_text | STRING | — | |
| line_indices | STRING | 1|2 | — |
| split_char | STRING | — |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |
| STRING | STRING | — |
| STRING | STRING | — |
| STRING | STRING | — |
| STRING | STRING | — |
| STRING | STRING | — |