These days, my main hammer is Emacs and most tasks can be made to look like nails. Throughout my career, though, one of my go to tools was awk. It’s perfect for processing text files with its implied do loop that processes each line, its builtin pattern matching, and its wide selection of functions to work on text elements.
The definitive documentation is The AWK Programming Language book but that’s hard to find now and expensive when you can. Fortunately, awk is fairly easy to understand and the GNU Awk User’s Guide provides detailed documentation.
Yang Zhou has a very nice post that serves as a quick introduction to awk by demonstrating the common awk program patterns. It doesn’t begin to cover the richness of the language but it’s excellent for getting you started. If you’re not already familiar with awk, take a couple of minutes to read Zhou’s post. It’s a nice peak at a very useful scripting language and may inspire you to learn more about it. You might find it a powerful tool that can do all sorts of text jobs easily. And, of course, it’s available everywhere. You can even get the source for the original awk that should compile in most C environments.