This commit is contained in:
sejo 2021-12-01 18:02:33 -06:00
parent ae7b75450c
commit 1ae13830bf
1 changed files with 22 additions and 3 deletions

View File

@ -4,6 +4,11 @@ an awk-ward (or not really) language.
some notes in process.
# resources
=> https://www.gnu.org/software/gawk/manual/html_node/index.html gawk user's guide
=> https://www.tutorialspoint.com/awk/index.htm awk tutorial: tutorialspoint
# some built-in variables
* FS: input field separator (by default, space)
@ -21,7 +26,6 @@ $0 represents the entire input record, and $n the nth field in the current recor
# some built-in functions
=> https://www.tutorialspoint.com/awk/awk_built_in_functions.htm awk tutorial: built-in functions
=> https://www.tutorialspoint.com/awk/awk_miscellaneous_functions.htm miscellaneous functions
=> https://www.tutorialspoint.com/awk/awk_string_functions.htm string functions
@ -49,10 +53,10 @@ the index of the first character is 1!
* system: execute the specified command and returns its exit status
* delete: delete an element from an array, or an array
## gawk only
# gawk
=> https://www.gnu.org/software/gawk/manual/html_node/Bitwise-Functions.html bit-manipulation functions
=> https://www.gnu.org/software/gawk/manual/html_node/index.html gawk user's guide
=> https://www.gnu.org/software/gawk/manual/html_node/Bitwise-Functions.html bit-manipulation functions
note: to run in compatibility mode, without gnu extensions, use the -c or --traditional flag:
@ -62,6 +66,21 @@ $ awk -c
# other notes
* apparently counters/accumulators don't need to be initialized at 0
* boolean values are 0 or 1
## 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.
## loop through the elements of an array
```