ex (which is equivalent to
ex +"g/local/s/$/;/g" -cwq foo.txt
test.txt files recursively:
ex +"bufdo g/local/s/$/;/g" -cxa **/test.txt
If extended globbing doesn't work (
**), enable it via:
shopt -s globstar.Note: Make sure that globbing option (
**) is enabled by:
shopt -s globstar if your shell supports it.
:bufdo command is not POSIX.