Awk

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen

Awk is a scripting language for manipulating data in files. Around 2021-2022, I Occasionally switch between data in spreadsheets and in associative Bash arrays. So maybe I've just been looking for Awk?

Examples

Output a file to screen:

awk '{print}' bestand.txt

of

awk '{print $0}' bestand.txt

where $0 represents the entire line.

Print only the first column of the file (where fields are separated by a space);

awk '{print $1}' bestand.txt

Filter rules according to a regular expression: All lines starting with the string 'w':

awk '/^w/ {print $1}' bestand.txt

See also

Sources