Comments on Simplest way of stripping leading/trailing whitespace from file or program output
Post
Simplest way of stripping leading/trailing whitespace from file or program output
+4
−1
What is the simplest shell idiom for stripping leading and trailing whitespace from a file or program output? Ideally I am looking for the equivalent of trim
or strip
methods in some languages.
The ideal solution should
- skip empty lines at the beginning and end of the file/stream
- provide an option to also strip leading and trailing whitespace from all non-empty lines
1 comment thread