Clean a text file in two steps
This pipeline renames order labels and removes extra spaces without joining their lines.
- Free
- Included: two transformation layers
- Pro
- Included
- Self-hosted
- Text processing bundle
Load the input
- Open Text Pipeline in the left navigation rail.
- Paste this text into the pinned Input tab:
ORD-0042 pending
ORD-0187 sent
You can also save the text as orders.txt and select browse files in the empty input.
File contents load locally. A final line break remains in the output.
Rename the prefix
- Select Add layer > Regex > Regex substitution.
- Open the new tab's Tab actions > Flavor menu and select JavaScript.
- Enter
\bORD-([0-9]{4})\bin Regular Expression. - Enable only the
gflag. - Enter
Order $1in Substitution. - Press Cmd + Enter on macOS or Ctrl + Enter elsewhere.
The layer makes two replacements:
Order 0042 pending
Order 0187 sent
$1 keeps the captured digits. The spaces before each status remain unchanged.
Normalize spaces and tabs
- Select Add layer > Text > Collapse spaces and tabs.
- Run the pipeline again.
- Inspect the new layer's Output:
Order 0042 pending
Order 0187 sent
The template uses [ \t]+ to replace spaces and tabs with one space. It preserves line breaks.
The execution trace reports each layer's replacements separately.
Inspect and copy the result
- In the output heading, open View: Output and select Changes.
- Compare the extra spaces on the left with the normalized text on the right.
- Select Pipeline actions > Copy final output.
- Paste the result into a new file named
orders-clean.txt.
Select an execution-trace row to inspect an earlier layer. If a layer reports an error, correct it and run again before copying.
Save the reusable pipeline
To keep the workspace in My workspaces, sign in before saving.
- Select Save & Share > Save Workspace.
- Copy the Access Link.
- Reopen that link to restore the input and both layers.
Use Update Workspace after editing a saved pipeline to create another version.