0

I'm looking for a script to recursively replace a formatted block of text across all files and directories, with the search and replace text coming from external files. For example:


find.txt

Lorem ipsum dolor sit amet, consectetur adipiscing elit,
    do eiusmod tempor incididunt ut labore et 
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud

replace.txt

Excepteur sint occaecat cupidatat 
   non proident, sunt in 
       culpa qui officia 
       deserunt mollit anim id 
est laborum

And then a simple command along the lines of:

replace find.txt replace.txt /some/dir/*

This one is close but not quite. But it looks like perl slurp might be part of the solution?

I don't care what language it's scripted in, as long as it's common and runs on Linux. Thanks a lot!

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.