echo "AXIS2C_HOME=/usr/local/Axis2C" | sed 's/(^AXIS2C_HOME=) (.*)/ \2 \1/'
The output i am expecting is /usr/local/Axis2C AXIS2C_HOME=
I cant figure out what i am doing wrong :(
|
echo "AXIS2C_HOME=/usr/local/Axis2C" | sed 's/(^AXIS2C_HOME=) (.*)/ \2 \1/' The output i am expecting is /usr/local/Axis2C AXIS2C_HOME= I cant figure out what i am doing wrong :(
| ||||
feedback
|
|
The trivial answer is "more backslashes, less spaces":
But the broader answer is, "wait, what are you trying to do?" Do you want the key-value pairs to be split into useful variables, or are you really just trying to munge the input into the reverse syntax in order t feed it to something else? | |||
|
feedback
|
|
You have an erroneous space after the
The following also works and is a bit shorter.
| |||
|
feedback
|
|
Sed is great, but Perl can do this too, and it doesn't require the forest of backslashes:
Plus, you've got the full power of the regular expression engine, so you can do even more complex patterns. | |||||||
feedback
|