I need to do a find/replace in multiple files but I want to keep the first occurrence of the match and replace all others. THis may have been answered else where but it's a bit difficult to search for.
I am currently using: perl -pi -w -e 's/THING/SOMETHING_ELSE/g;' ./src/**/*.py
A practical example:
from stuff import THING
print(f"use {THING} here")
print(f"use {THING} there")
print(f"use {THING} everywhere")
Should become:
from stuff import THING
print(f"use {SOMETHING_ELSE} here")
print(f"use {SOMETHING_ELSE} there")
print(f"use {SOMETHING_ELSE} everywhere")