Change text based on file name

Can anybody help me with an automater script that looks for a file name and then do a search and replace based on the file name

Here`s an example:
file A and B has the word “green” in them, i want to change the word “green” to “blue” if the file name is A end “red” if the file name is B


I think I get what you want to do.

Try this in automator. I tried it and it worked for me. I created three files on my desktop and called them “greengolucky” “howgreen” and “silvergreen”. Then I executed the below workflow and they found these files and changed them to “bluegolucky” “howgreen” and “silverblue”

Let me know if that works!