testing on Linux [Remove white space] testing on Linux
testing on Linux [Removewhitespace] testing on Linux
So, how can we just remove all the white space between the brackets and achieve output as given ?
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
That is use
With sed, with the additional requirement that there be no newline character inside
If they are balanced but may be nested as in
Another approach, which would scale to very large files would be to use the
Actually, you can also process the input one character at a time like:
That approach can be implemented with POSIX tools:
Are considered white space above any horizontal (SPC, TAB) or vertical (NL, CR, VT, FF...) spacing character in the ASCII charset. Depending on your locale, others might get included.
Perl 5.14 solution (which is shorter and IMO easier to read—especially if you format it over multiple lines in a file, instead of as a one-liner)
That works because in 5.14, the regular expression engine is re-entrant. Here it is, expanded out and commented: