[ACCEPTED]-Remove all whitespaces in a file- Linux-sed

Accepted answer
Score: 67

Depending on your definition of whitespace, something 1 like:

tr -d ' \t\n\r\f' <inputFile >outputFile

would do the trick.

Score: 16
sed 's/\s//g' input.txt | tr -d '\n'

0

Score: 11
sed 's/\s//g'|tr -d '\n'

0

Score: 3

If you have UTF-8 data, best do this:

perl -CS -pe 's/\p{Space}//g' < input > output

0

More Related questions