Solved

Find and Replace with sed

Posted on 2011-03-11
2
496 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
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

773 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