Awk

"The awk command takes stream editing one step further than the sed editor by providing a programming language instead of just editor commands. Within the awk programming language, you can do the following: Define variables to store data. Use arithmetic and string operators to operate on data. Use structured programming concepts and control flow, such as if-then statements and loops, to add logic to your text processing. Generate formatted reports."

https://dzone.com/articles/30-examples-for-awk-command-in-text-processing