![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Trailing spaces chopped off - MF to Unix FTP. | videsh77 | UNIX for Advanced & Expert Users | 14 | 01-08-2009 05:06 PM |
| Remove Trailing spaces after a delimiter | kiran_418 | UNIX for Dummies Questions & Answers | 1 | 04-29-2008 02:19 PM |
| How to remove trailing spaces | mahek_bedi | UNIX for Dummies Questions & Answers | 2 | 08-10-2007 07:21 AM |
| Removing leading and trailing spaces of data between the tags in xml. | jhmr7 | UNIX for Dummies Questions & Answers | 2 | 05-18-2005 10:27 AM |
| Leading and Trailing Spaces | sleepster | Shell Programming and Scripting | 7 | 10-29-2003 11:48 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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 Thnx ![]() |
|
||||
|
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 |
|
||||
|
The double quotes did the trick. Thanks for your input.
![]() |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|