Comments on Substituting text in a sed like manner but with a richer format
Post
Substituting text in a sed like manner but with a richer format
+1
−4
I have the following problems working with sed
:
- It doesn't allow multiline operations (thus, no indentations, no nesting)
- It is generally obligatory to wrap entire commands in quote marks (
sed "SED_COMMAND" FILE
) even if the command itself contains quote marks.
Without these problems I could format a long liner such as sed -i "s/\$to = ".*";$/\$to = example@example.com;/g" PATH
as in this pseudocode:
sed -i
A
\$to = ".*";$
B
\$to = example@example.com;
G
PATH
- A means "from"
- B means "to"
- G means "global"
Since sed
doesn't work this way, how could I achieve a similar syntax in the shell? Perhaps by using Python? Perl? Something else?
1 comment thread