R
R
Ruslan Banochkin2016-04-14 10:45:59
linux
Ruslan Banochkin, 2016-04-14 10:45:59

How to bulk replace a piece of text from several lines in multiple files?

Good afternoon.
The server hosts many sites with the same type of templates and .htaccess. There was a need to immediately change one block in the template on all sites and slightly correct .htaccess.
The problem is that you need to edit blocks with text on several lines.
How can I do this?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Y
Yuri Chudnovsky, 2016-04-14
@Frankenstine

Basically, you can just do one monstrous replacement command with sed.

V
Victor Taran, 2016-04-14
@shambler81

Unfortunately, it's best to use not bash, sed is great for a line in this regard, but full-fledged regular expressions with a line break, etc., are better to use php.

A
abcd0x00, 2016-04-15
@abcd0x00

The problem is that you need to edit blocks with text on several lines.

For sed, this is not a problem, you just need to know it a little further than s///.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question