I want to apply a certain regular expression substitution globally to about 40 Javascript files in and under a directory. I\'m a vim user, but doing this by hand can be ted
You can automate the actions of both vi and ex by passing the argument +'command' from the command line, which enables them to be used as text filters.
In your situation, the following command should work fine:
find /path/to/dir -name '*.js' | xargs ex +'%s/,\(\_\s*[\]})]\)/\1/g' +'wq!'