I try to replace "_" to "/"
$ echo "hahahaa_the_cat_hahahaa" | sed "s/_///g"
It doesn't work.
I try to replace "_" to "/"
$ echo "hahahaa_the_cat_hahahaa" | sed "s/_///g"
It doesn't work.
The substitution operator (s/old/new/) can take any character as a delimiter:
$ echo foo | sed 's|f|g|'
goo
$ echo foo | sed 'safaga'
goo
So just use anything that isn't / and you can do what you want:
$ echo "hahahaa_the_cat_hahahaa" | sed 's|_|/|g'
hahahaa/the/cat/hahahaa
Alternatively, you can escape the / with a \ (write \/):
$ echo "hahahaa_the_cat_hahahaa" | sed 's/_/\//g'
hahahaa/the/cat/hahahaa
The problem is that you're using / as your delimiter in sed while also using it as the character to substitute.
Try using a different delimiter such as |:
$ echo "hahahaa_the_cat_hahahaa" | sed 's|_|/|g'
Escape the slash / character by backslash \:
$ sed 's/_/\//g' <(echo 'https:__askubuntu.com')
https://askubuntu.com
ie. using a \ before the "/" stops the "/" being seen as a seperator, but as a character to be translated... (this probably isn't worded very well sorry)