Skip to content
NMSnabbit.

Remove Suffix From Each Text Line

Strip a suffix string from the end of every line.

Text Tools Runs in your browser

How do you remove a suffix from each line?

Trailing junk at line ends disappears in one pass: set the suffix to “,” and “red,” “green,” “blue,” become red, green and blue on their own clean lines. Only lines that genuinely end with the string are touched, the comparison is exact including capitalisation, and everything else on the line survives. Use it to drop file extensions, closing tags or a label repeated at every line end.

How to use the Remove Suffix From Line

  1. 1 Load your lines into the editor.
  2. 2 Specify the ending to cut, such as “,” or “.txt”.
  3. 3 Only lines finishing with that exact string are trimmed.
  4. 4 Copy the cleaned lines.

What you can use it for

  • Dropping trailing commas from a pasted list.
  • Cutting a file extension off each filename.
  • Clearing a repeated tag from line ends.
  • Undoing a suffix added by mistake.

Frequently asked questions

Can it clear trailing commas from a pasted array?
Yes. Set “,” as the suffix and each line ending in a comma loses it; lines without one are ignored.
Is “.TXT” the same as “.txt” here?
No. The ending must match exactly, case included, so mixed-case data may need two passes.
Will it cut the string from the middle of a line?
Never. Only the very end of the line is checked, so a comma inside a sentence is safe.

Related tools

More Text Tools

More tools like this:

All Text Tools