Some gawk extensions and libraries

Here are some source libraries and extensions for gawk (the GNU awk implementation) of which I'm the author or else involved someway.

gawkextlib

Initially named XMLgawk (2004) and later xgawk (2006). Currently renamed as gawkextlib (2012). It started as a fork of gawk, with XML processing capability. Later recoded as a shared library extension with added support for PostgreSQL, GD graphics library, and more.

Gawkextlib is now a repository of gawk extensions that can be loaded independently. There are more than a dozen extensions, and new additions are expected from time to time.

The project is hosted at SourceForge:
- http://sourceforge.net/projects/gawkextlib/
- http://gawkextlib.sourceforge.net/

gawk-csvio

- Read documentation

[see files] [download .zip] [download .tar.gz]

gawk-csvio is a gawk library that supports CSV data management in a straightforward way. Example, convert a CSV file to tab-delimited file:

gawk '
    BEGIN{ FS=OFS="\t" }
    @include "csvio"
    {
        csvimport()
        print csvrecord()
    }
    ' some_data_file.csv
    

awk-csvio

- Read documentation

[see files] [download .zip] [download .tar.gz]

awk-csvio is a POSIX awk library that supports CSV data management in a straightforward way. Example, convert a CSV file to tab-delimited file:

awk -f csvio.awk '
    BEGIN{ FS=OFS="\t" }
    {
        csvimport()
        print csvrecord0()
    }
    ' some_data_file.csv
    

csvmode (deprecated)

- Read documentation

[see files] [download .zip] [download .tgz]

Csvmode is a gawk library that supports CSV data management in a straightforward way. Example, print the second and third fields:

gawk '@include "csvmode1"; {print $2, $3}' some_data_file.csv
- CSV input: a,"b,c",d
- CSV output: "b,c",d

webargs

[see files] [download .zip] [download .tar.gz]

Webargs is a small utility that enables some restricted form of URLs as file input arguments for gawk. Example:

gawk -f webargs.awk -f myscript.awk some_local_file.txt http://some.remote/file.html

encodargs

[see files] [download .zip] [download .tar.gz]

Encodargs is a proof-of-concept module that automatically converts encoding of gawk input files on request. It allows mixing textual data with disparate encodings in the same gawk invocation. To request encoding conversion, just append the suffix ::encoding to the file name argument. Example:

gawk -f encodargs.awk -f myscript.awk normal_file.txt foreign_file.txt::iso-8859-15

Encodargs requires the iconv(1) utility to be installed.


Manuel Collado