💾 Archived View for compudanzas.net › awk.gmi captured on 2022-07-16 at 13:45:19. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-06-11)

➡️ Next capture (2023-01-29)

🚧 View Differences

-=-=-=-=-=-=-

awk

an awk-ward (or not really) language.

some notes in process.

projects

the static site generator for the compudanzas.net wiki is mostly written in awk:

wiki

generator and source files for the compudanzas.net site

g2e is an opinionated gempub to epub converter written in awk:

g2e

my solutions for advent of code 2021 have been written in awk.

advent of code 2021

resources

gawk user's guide

awk tutorial: tutorialspoint

some built-in variables

$0 represents the entire input record, and $n the nth field in the current record (starting to count from 1)

awk tutorial: built-in variables

some built-in functions

awk tutorial: built-in functions

miscellaneous functions

string functions

strings

the index of the first character is 1!

misc

Explicit Input with getline

The getline command is used in several different ways and should not be used by beginners.

(?)

gawk

gawk user's guide

bit-manipulation functions

note: to run in compatibility mode, without gnu extensions, use the -c or --traditional flag:

$ awk -c

other notes

record separation

records separated by empty lines can be extracted with:

RS = ""

without modifying FS, fields will be separated by any whitespace, including newlines.

gawk allows regexp in RS, traditional awk will only accept one character.

field separation

one can get one character at a time by setting (in gawk?) :

FS = ""

loop through the elements of an array

this approach might yield the results in different order depending on the awk implementation.

arr["a"] = 1
arr["b"] = 2

for(key in arr)
  print key ": " arr[key]

incoming links

gemini

advent of code 2021

wiki

introduction to uxn programming book

traducciones

introducción a programación uxn

apuntes

meta

compudanzas

contact

text, images, and code are shared with the peer production license