reclen − fixed-length record input parser for gawk
@load
"reclen"
...
RECLEN = 42
...
reclen::drop("/some/file")
The reclen extension adds an input parser for reading fixed-length records, and a function that can be used to stop reading fixed-length records.
If the RECLEN variable exists and has a value greater than zero when gawk goes to open a data file, this extension takes over and returns records of length RECLEN. The variable is checked before reading each record, so the AWK program can change how much will be read as it goes along.
Setting RECLEN to zero causes any subsequent read of the file to return end of file to gawk.
In order to permanently stop reading fixed-length records and restore gawk’s normal reading mechanism, call reclen::drop() with the name of the file. This is a one-way operation; going back to using RECLEN is then not possible without first closing the file.
@load
"reclen"
...
BEGIN { RECLEN = 42 }
...
GAWK: Effective AWK Programming,
Arnold Robbins, arnold@skeeve.com.
Copyright © 2020, Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this manual page provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual page under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual page into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Foundation.