Nice trick just using echo command:
$ str=" a string "
$ echo "[$str]"
[ a string ]
$ new=$(echo $str)
$ echo "[$new]"
[a string]
To trim an entire file:
sed 's/^[ \t]*//;s/[ \t]*$//' < input_file
Nice trick just using echo command:
$ str=" a string "
$ echo "[$str]"
[ a string ]
$ new=$(echo $str)
$ echo "[$new]"
[a string]
To trim an entire file:
sed 's/^[ \t]*//;s/[ \t]*$//' < input_file
For further actions, you may consider blocking this person and/or reporting abuse
Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.
Gilles Hamelink -
Pawani Madushika -
Pawani Madushika -
Pawani Madushika -
Top comments (0)