![]() |
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 |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Array help (variable substitution). | dsimpg1 | Shell Programming and Scripting | 3 | 04-11-2007 04:38 PM |
| KSH variable substitution | tipsy | Shell Programming and Scripting | 5 | 08-14-2006 05:07 PM |
| Variable Substitution | garak | Shell Programming and Scripting | 2 | 03-16-2006 08:55 PM |
| awk variable substitution | apalex | UNIX for Dummies Questions & Answers | 1 | 09-10-2004 06:02 PM |
| variable substitution | ck-18 | UNIX for Dummies Questions & Answers | 1 | 05-16-2003 08:44 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Substitution in a variable
Hey All,
I'm trying to clean up a variable using sed but It dosn't seem to work. I'm trying to find all the spaces and replace them with "\ " (a slash and a space). For Example "Hello World" should become "Hello\ World". But it does nothing. If I put it directly into the command line it works fine. Here's my code... #!/bin/sh var_name="Hello World" echo "var_name is $var_name" var_name=`echo $var_name |sed 's/ /\\ /g'` echo "Cat_name has changed to $Cat_name" Thanks, G |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|