In addition to the languages already mentioned in other answers, macOS Mojave also comes with the general purpose programming language PHP, which is well suited to processing a number of files in a directory and performing custom logic.
In addition, macOS Mojave also comes with the programming languages awk and m4 that are specifically suited for processing text files in this manner.
If you're also looking at compiled languages, it is possible to use C, C++ and Objective-C from the command line without installing the whole XCode. You only need to install the Xcode Command Line Tools. In that same package you'll find the "swift" command that allows you to run scripts in the Swift programming language without having to compile them first.