Python:
#!/usr/bin/python3 # test.py import fileinput import sys def process_line(s): # do something to a string return s for fname in sys.argv[1:]: for line in fileinput.input(files=fname, inplace=True, backup='.bak'): print(process_line(line))
usage: ./test.py *html
Perl:
perl -pi.bak -e 's/<REGEX>/<REGEX>/g' <FILES>