How to assign value to variable with regex (bash)?
2 answers
I believe you want to use string replacement like this:
oldip_a=${oldip//\\/}
Or something like that ... Of course, always the battle escapes the backslash!
A more obvious example:
some_variable=${some_other_variable//replaceEachOfThese/withThis}
find "replace all matches" on this page:
http://tldp.org/LDP/abs/html/string-manipulation.html
+4
source to share