AWK is a scripting language that does exactly that in a straightforward way.
It's pretty easy to write scripts using awk to grab data from text files and transform that data for use elsewhere. awk scripts can use regular expressions or other patterns to select data and use a host of standard functions to manipulate data and print output.
Use this handy cheat sheet to quickly reference most of awk's features.
To download this cheat sheet, log in or enter your email address and country below.