Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the benefit of -s or --squeeze-repeats when we use tr? What practical usage?

share|improve this question
up vote 3 down vote accepted

The GNU coreutils manual gives some example applications such as collapsing multiple newlines into one (tr -s '\n'), or putting each word on its own line while removing punctuation at the same time (tr -cs '[:alnum:]' '[\n*]').

share|improve this answer

How to make the 'cut' command treat several sequential delimiters as one?

$ cat text.txt | tr -s " " " " | cut -d " " -f 4
share|improve this answer
< text.txt tr -s ' ' | cut -d' ' -f 4 is shorter: it leaves out the unnecessary second argument to tr and the UUOC. – jw013 Feb 14 '12 at 16:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.