User Tools

Site Tools


linux:text

This is an old revision of the document!


WORKING WITH TEXT IN LINUX

TR

tr (translate) is a stream filter that operates on single characters, not patterns or words. It reads stdin and writes stdout, transforming one character at a time.

SQUEEZE

Squeeze (-s) collapse repeats:

tr -s ' '              # multiple spaces → single space
tr -s '\n'             # collapse blank lines
tr -s ' ' ','          # squeeze spaces AND translate to comma (combined)
linux/text.1779264093.txt.gz · Last modified: by v1ctor