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
DPC -
Brijesh Dobariya -
Harshil Khokhani -
Rodolfo Olivieri -
Top comments (0)