Awk
awk
What is awk command?
awk is a scripting language, and it is helpful when working in the command line. It's also a widely used command for text processing. When using awk, you are able to select data – one or more pieces of individual text – based on a pattern you provide.
For example, some of the operations you can do with awk are searching for a specific word or pattern in a piece of text given, or even select a certain line or a certain column in a file you provide.
The Basic Syntax of the awk command
In its simplest form, the awk command is followed by a set of single quotation marks and a set of curly braces, with the name of the file you want to search through mentioned last.
It looks something like this:
awk '{action}' your_file_name.txt
When you want to search for text that has a specific pattern or you're looking for a specific word in the text, the command would look something like this:
awk '/regex pattern/{action}' your_file_name.txt
With test file looking like this:
fristName lastName age city ID Thomas Shelby 30 Rio 400 Omega Night 45 Ontario 600 Wood Tinker 54 Lisbon N/A Giorgos Georgiou 35 London 300 Timmy Turner 32 Berlin N/A