Reputation: 33
quick question
I have this line:
regexp: \[apm,(.*)\]apm-(.*)\.pivotal
And I want to be like that:
regexp: \[apm,(.*)\]app-metrics(.*)\.pivotal
The sed command that I'm using and it's not working is that one:
sed -i -E 's/regexp: \\[apm,(.\*)\\\]apm-(.\*)\\.pivotal/regexp: \\[apm,(.\*)\\\]app-metrics(.\*)\\.pivotal/g' FILE_THAT_CONTAINS_THE_LINE
Upvotes: 1
Views: 57
Reputation: 34337
sed -i -E 's/regexp: \\\[apm,\(\.\*\)\\\]apm-\(.\*\)\\\.pivotal/regexp: \\[apm,(.*)\\]app-metrics(.*)\\.pivotal/' file.txt
you have some escapes missing
Upvotes: 1
Reputation: 7277
Try to simplify it
sed '/regexp:.*apm.*apm-.*pivotal/s/apm-/&metrics/' FILE...
Upvotes: 2