The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: Replace spaces
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 10-06-2008
tret tret is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 29
Quote:
Originally Posted by cfajohnson View Post

Code:
string=$( printf "%s\n" "$string" | sed 's/ /%20/g' )
Or. with bash or ksh93:

Code:
string=${string// /%20}
Hey thanks cfajohnson, that did the trick, the second suggestion works perfectly!

Thanks again for being so helpful guys, I really appreciate it.