LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to replace special character by any word in a string. (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-replace-special-character-by-any-word-in-a-string-664253/)

mksc 08-21-2008 01:49 AM

how to replace special character by any word in a string.
 
hi all

I have a variable which contains string.
let suppose
var="You should include as much detail as possible in your message, including exact error messages (where applicable) & what you have done so far."

in this string I want to replace "&" symbol with "and".

How it is possible using shell command.



with regards
MKSC

kkpal 08-21-2008 02:33 AM

var=`echo ${var//&/and}`


All times are GMT -5. The time now is 01:43 PM.