How would I remove ALL whitespaces in a given file in Linux?
Press Shift + Alt then press the down button before "56". Then backspace . You will see the cursor becomes big and then you can remove the spaces all at once.
The replaceAll() method of the String class replaces each substring of this string that matches the given regular expression with the given replacement. You can remove white spaces from a string by replacing " " with "".
Depending on your definition of whitespace, something like:
tr -d ' \t\n\r\f' <inputFile >outputFile
would do the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With