Solved

Find and Replace with sed

Posted on 2011-03-11
2
494 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 500 total points
Comment Utility
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
Comment Utility
Try this
sed "s/\//\\/g"

Open in new window

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now