sed, replacing underscore with whitespace
hi, I am currently writting a bash script to replace a string with underscore '_' to a whitespace ' '.
How can I use sed to achieve that?
Below is my snippet of my script:
LONG_STRING_WITH_UNDERSCORE = "This_is_my_script"
LONG_STRING_WITH_WHITESPACE = `cat $LONG_STRING_WITH_UNDERSCORE | sed -e 's,_, ,g'`
Is this the correct way?
run the script and find out!
if there are errors, it means not correct, right?
hint: use echo instead of cat and see how it goes
Ran it and it gives me
"cat: This_is_my_script: No such file or directory."
You could also just use tr since all you're doing is substituting one char for another.
|All times are GMT -5. The time now is 02:10 AM.|