Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-21-2008, 01:49 AM   #1
LQ Newbie
Registered: May 2008
Posts: 10

Rep: Reputation: 0
Thumbs up 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
Old 08-21-2008, 02:33 AM   #2
Registered: Oct 2007
Posts: 101

Rep: Reputation: 15

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
block special and character special files s_shenbaga Linux - Newbie 4 06-23-2015 02:16 AM
How do I replace special characters in a string within a bash script? rhaup0317 Linux - Newbie 2 06-03-2008 11:56 AM
find a string followed by any word character in bash bryan.out.there Programming 2 07-12-2006 06:36 AM
problem in perl replace command with slash (/) in search/replace string ramesh_ps1 Red Hat 4 09-10-2003 01:04 AM
i need help with a special character Hone101 Linux - Newbie 1 05-03-2003 07:21 PM

All times are GMT -5. The time now is 03:57 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration