LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-14-2005, 03:43 PM   #1
venky_2_2000
LQ Newbie
 
Registered: Aug 2005
Posts: 15

Rep: Reputation: 0
sed help


Hello friends ,

I need help with sed .

echo "/c/dumc"

when i do echo i would like to change the first "c" to d with sed and this change should not effect the "c" which is in dumc and the output should be

d/dumc.

thanks,
venky
 
Old 09-14-2005, 03:50 PM   #2
mfeat
Member
 
Registered: Aug 2003
Location: Akron, OH
Distribution: Fedora Core 3
Posts: 185

Rep: Reputation: 30
echo "/c/dumc" | sed s.c.d.
 
Old 09-15-2005, 04:04 AM   #3
venky_2_2000
LQ Newbie
 
Registered: Aug 2005
Posts: 15

Original Poster
Rep: Reputation: 0
dear friend ,

pls give me the correct syntax

thanks
 
Old 09-15-2005, 04:58 AM   #4
venky_2_2000
LQ Newbie
 
Registered: Aug 2005
Posts: 15

Original Poster
Rep: Reputation: 0
Thank you very much friend it is working .

thank you for gud hint.
 
Old 09-15-2005, 06:51 AM   #5
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
You were likely thinking of the familiar / which I prefer. There are a few other options.
Code:
echo "/c/dumc" | sed s/c/d/
/d/dumc

echo "/c/dumc" | sed s.c.d.
/d/dumc

echo "/c/dumc" | sed s,c,d,
/d/dumc

echo "/c/dumc" | sed s-c-d-
/d/dumc

echo "/c/dumc" | sed s=c=d=
/d/dumc

echo "/c/dumc" | sed s[c[d[
/d/dumc

echo "/c/dumc" | sed s~c~d~
/d/dumc

echo "/c/dumc" | sed s:c:d:
/d/dumc
 
  


Reply



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
sed and escaping & in something like: echo $y | sed 's/&/_/g' prx Programming 7 02-03-2005 11:00 PM
Sed q? ky-lab_rat Linux - Software 5 10-26-2004 07:59 AM
Insert character into a line with sed? & variables in sed? jago25_98 Programming 5 03-11-2004 06:12 AM
Help with sed odious1 Linux - General 2 08-29-2003 10:52 AM
help with sed DavidPhillips Programming 3 08-11-2003 04:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:18 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration