I am trying to write a script that copies the file log_REPLACE
, and replaces the string REPLACE
in the name of the file, and within the file with the letter A
and B
.
So I want to create log_A
, and log_b
, and the string REPLACE
inside them is replaces with the letter A and B in them respectively.
I'm trying:
cp log_REPLACE log_A
cp log_REPLACE log_B
grep -rl REPLACE | xargs sed -i 's/REPLACE/A/g'
but that end up rewriting in both copies (*A and *B). is there a better way to do this?