Top "Gawk" questions

AWK is an interpreted programming language designed for text processing and typically used as a data extraction and reporting tool.

Print second last column/field in awk

I want to print the second last column or field in awk. The number of fields is variable. I know …

awk gawk
awk - concatenate two string variable and assign to a third

In awk, I have 2 fields: $1 and $2. They are both strings that I want to concatenate and assign to a variable.

awk gawk
how to use sed, awk, or gawk to print only what is matched?

I see lots of examples and man pages on how to do things like search-and-replace using sed, awk, or gawk. …

regex unix sed awk gawk
print every nth line into a row using gawk

I have a very huge file in which I need to obtain every nth line and print it into a …

printing awk line gawk
How to use multiple arguments for awk with a shebang (i.e. #!)?

I'd like to execute an gawk script with --re-interval using a shebang. The "naive" approach of #!/usr/bin/gawk --re-interval …

shell unix awk gawk shebang
Bash: Parse CSV with quotes, commas and newlines

Say I have the following csv file: id,message,time 123,"Sorry, This message has commas and newlines",2016-03-28T20:26:39 456,"…

bash csv awk cut gawk
Sort associative array with AWK

Here's my array (gawk script) : myArray["peter"] = 32 myArray["bob"] = 5 myArray["john"] = 463 myArray["jack"] = 11 After sort, I need the following result : …

awk gawk asort
Using linux command "sort -f | uniq -i" together for ignoring case

I am trying to find unique and duplicate data in a list of data with two columns. I really just …

linux sorting awk gawk uniq
convert a fixed width file from text to csv

I have a large data file in text format and I want to convert it to csv by specifying each …

linux csv awk export-to-csv gawk