Skip to Content
gnux

-s, --squeeze-repeats

Replace each sequence of a repeated character that is listed in the last specified SET, with a single occurrence of that character.

An option of trx.

Usage

trx -s STRING1 [STRING2]
trx --squeeze-repeats STRING1 [STRING2]

Details

ShortLongValueDefaultMeaning
-s--squeeze-repeatsnonereplace each sequence of a repeated character that is listed in the last specified SET, with a single occurrence of that character

Examples

Squeeze runs of spaces into one

echox 'a    b     c' | trx -s ' '

Put each word on a line of its own

catx essay.txt | trx -cs '[:alnum:]' '\n'

Delete digits and squeeze the spaces left behind

echox 'a 1 2 b' | trx -ds '[:digit:]' ' '

Help in the terminal

gnux help trx --squeeze-repeats

On this page