Search recursively (-r) in folder and its subdirectories (-i) for the string "test" and print the line number (-n) of each match. Replace (-i) each occurrence of "test" with "replace" in the output of the command.
grep -irn "test" folder/* | sed -i s/test/replace/g