Substituting text in a sed like manner but with a richer format
I have the following problems working with
- 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 = email@example.com;/g" PATH as in this pseudocode:
sed -i A \$to = ".*";$ B \$to = firstname.lastname@example.org; G PATH
- A means "from"
- B means "to"
- G means "global"
sed doesn't work this way, how could I achieve a similar syntax in the shell? Perhaps by using Python? Perl? Something else?