I am trying to strip all leading and trailing spaces of a shell variable using either awk or sed or any other utility, however unscuccessful and need your help.
echo $SH_VAR | command_line Syntax.
The SH_VAR contains embedded spaces which needs to be preserved. I need only for the leading and trailing spaces to be removed. If anyone has accomplished this before or knows a quick way to achieve this result please let me know
I have encountered an issue in my previous command.
The command works for a variable with a single space embedded in it.
However when you have more than one space in the variable value the command strips extrac spaces and leaves only one inside of the value.
Ex: a=' abc de f '
returns b='abc de f'
however if a=' abc de f '
returns b='abc de f'
Any suggesstions to overcome this issue would be much appreciated. Thanks