LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices

Reply
 
Search this Thread
Old 08-21-2008, 01:49 AM   #1
mksc
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
MKSC
 
Old 08-21-2008, 02:33 AM   #2
kkpal
Member
 
Registered: Oct 2007
Posts: 101

Rep: Reputation: 15
Smile

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


Reply


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
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
block special and character special files s_shenbaga Linux - Newbie 1 04-20-2005 03:49 PM
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 09:06 PM.

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