?
Solved

Find and Replace with sed

Posted on 2011-03-11
2
Medium Priority
?
504 Views
Last Modified: 2012-05-11
I am trying to find all the / and replace them with \ using the sed command in linux. I just can't get the formatting right.

sed 's|/|\|'
sed 's|/|\|'

Open in new window

0
Comment
Question by:DowntownIT
2 Comments
 
LVL 12

Accepted Solution

by:
Amick earned 2000 total points
ID: 35114531
sed 's|/|\\|g'

you have to quote the backslash because it is a reserved character and g performs the action globally
0
 
LVL 31

Expert Comment

by:farzanj
ID: 35114618
Try this
sed "s/\//\\/g"

Open in new window

0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, an awarded photographer, Selina De Maeyer (http://www.selinademaeyer.com/), completed a photo shoot of a beautiful event (http://www.sintjacobantwerpen.be/verslag-en-fotoreportage-van-de-sacramentsprocessie-door-antwerpen#thumbnails) in An…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses
Course of the Month13 days, 12 hours left to enroll

755 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question