Skip to main content

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
Compare plans

Load the input​

  1. Open Text Pipeline in the left navigation rail.
  2. 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​

  1. Select Add layer > Regex > Regex substitution.
  2. Open the new tab's Tab actions > Flavor menu and select JavaScript.
  3. Enter \bORD-([0-9]{4})\b in Regular Expression.
  4. Enable only the g flag.
  5. Enter Order $1 in Substitution.
  6. 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​

  1. Select Add layer > Text > Collapse spaces and tabs.
  2. Run the pipeline again.
  3. 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​

  1. In the output heading, open View: Output and select Changes.
  2. Compare the extra spaces on the left with the normalized text on the right.
  3. Select Pipeline actions > Copy final output.
  4. 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.

  1. Select Save & Share > Save Workspace.
  2. Copy the Access Link.
  3. Reopen that link to restore the input and both layers.

Use Update Workspace after editing a saved pipeline to create another version.