A
A
anriko2020-03-23 17:45:35
bash
anriko, 2020-03-23 17:45:35

How to correctly form an expression replacement query?

here is my expression

grep '<a class="catalog-box__link" href="/"><i' -P -R -I -l  * | xargs sed -i 's/<a class="catalog-box__link" href="/"><i/<a class="catalog-box__link" href="##"><i/g'

here are the errors
sed: -e expression #1, char 44: unknown option to `s'
sed: -e expression #1, char 44: unknown option to `s'
grep: krasnodar/public_html/cgi-bin/php4.cgi: No such file or directory
sed: -e expression #1, char 44: unknown option to `s'

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
AUser0, 2020-03-23
@AUser0

So cross both of these options:

grep '<a class="catalog-box__link" href="/"><i' -P -R -I -l  * | xargs sed -i 's|<a class="catalog-box__link" href="/"><i|<a class="catalog-box__link" href="##"><i|g'

V
Viktor Taran, 2020-03-24
@shambler81

Did you mean it?
https://sed.js.org/?gist=c706a59d83d88852267bbe652...
If yes, then you did not take into account the specifics of escaping special characters in sed, I described this in more detail on the wiki.
If not, then give the original task.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question