Find and Replace with sed

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

LVL 2
DowntownITAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
AmickConnect With a Mentor Commented:
sed 's|/|\\|g'

you have to quote the backslash because it is a reserved character and g performs the action globally
0
 
farzanjCommented:
Try this
sed "s/\//\\/g"

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.