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.
Mike Young -
Aarav Joshi -
Game Dev Digest - The Newsletter On Unity Game Dev -
Pavol Z. Kutaj -
Top comments (0)