By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,775 Members | 1,115 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,775 IT Pros & Developers. It's quick & easy.

GNU sed version 4.1.2 swap text containing /

P: 1
I want to go through a file and swap anything that says http://nameofsite.com to ftp://nameofsite.com

sed s/http://nameofsite.com/ftp://nameofsite.com/ test.file

won't work because the text contains /

any help please?
Dec 1 '07 #1
Share this Question
Share on Google+
1 Reply

arne
Expert 100+
P: 315
I want to go through a file and swap anything that says http://nameofsite.com to ftp://nameofsite.com

sed s/http://nameofsite.com/ftp://nameofsite.com/ test.file

won't work because the text contains /

any help please?
What about

sed s/http/ftp/ test.file ?

If you other have other http entries you don't want to change, try \ (backslash) to escape / (forward slash):

sed s/http:\/\/nameofsite.com/ftp:\/\/nameofsite.com/ test.file

I'm not an expert in sed though ...

HTH,
arne
Dec 1 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.