frawk
frawk copied to clipboard
If possible minimize clash between gawk and frawk flags
If possible minimize clash between gawk and frawk flags:
❯ frawk -h
frawk 0.4
Eli R.
frawk is a pattern scanning and (semi-structured) text processing language
USAGE:
frawk [FLAGS] [OPTIONS] [--] [ARGS]
ARGS:
<program> The frawk program to execute
<input-files>... Input files to be read by frawk program
FLAGS:
-A, --arbitrary-shell
--dump-bytecode print bytecode for input program
--dump-cfg print untyped SSA form for input program
-h, --help Prints help information
-H, --parse-header consume the first line of input and populate the `FI` variable with
column names mapping to column indexes
--utf8 validate all input as UTF-8, returning an error if it is invalid
-V, --version Prints version information
OPTIONS:
-b, --backend <backend>
The backend used to run the frawk program, ranging from fastest to compile and slowest
to execute, and slowest to compile and fastest to execute. Cranelift is the default
[possible values: interp, cranelift, llvm]
-F, --field-separator <SEPARATOR> Field separator for frawk program.
-i, --input-format <input-format>
Input is split according to the rules of (csv|tsv). $0 contains the unescaped line.
Assigning to columns does nothing. [possible values: csv, tsv]
-j <jobs>
Number or worker threads to launch when executing in parallel, requires '-p' flag to be
set
-O, --opt-level <opt-level>
the optimization level for the program. Positive levels determine the optimization level
for LLVM. Level -1 forces bytecode interpretation [possible values: 0, 1, 2, 3]
--out-file <FILE> the output file used in place of standard input
-o, --output-format <output-format>
If set, records output via print are escaped according to the rules of the corresponding
format [possible values: csv, tsv]
-p <parallel-strategy>
Attempt to execute the script in parallel. Strategy r[ecord] parallelizes within and
accross files. Strategy f[ile] parallelizes between input files. [possible values: r,
record, f, file]
-f, --program-file <FILE> a file containing frawk program
-v, --var <var>... Has the form <identifier>=<expr>
❯ ./gawk --help
Usage: gawk [POSIX or GNU style options] -f progfile [--] file ...
Usage: gawk [POSIX or GNU style options] [--] 'program' file ...
POSIX options: GNU long options: (standard)
-f progfile --file=progfile
-F fs --field-separator=fs
-v var=val --assign=var=val
Short options: GNU long options: (extensions)
-b --characters-as-bytes
-c --traditional
-C --copyright
-d[file] --dump-variables[=file]
-D[file] --debug[=file]
-e 'program-text' --source='program-text'
-E file --exec=file
-g --gen-pot
-h --help
-i includefile --include=includefile
-l library --load=library
-L[fatal|invalid|no-ext] --lint[=fatal|invalid|no-ext]
-M --bignum
-N --use-lc-numeric
-n --non-decimal-data
-o[file] --pretty-print[=file]
-O --optimize
-p[file] --profile[=file]
-P --posix
-r --re-interval
-s --no-optimize
-S --sandbox
-t --lint-old
-V --version
To report bugs, see node `Bugs' in `gawk.info'
which is section `Reporting Problems and Bugs' in the
printed version. This same information may be found at
https://www.gnu.org/software/gawk/manual/html_node/Bugs.html.
PLEASE do NOT try to report bugs by posting in comp.lang.awk,
or by using a web forum such as Stack Overflow.
gawk is a pattern scanning and processing language.
By default it reads standard input and writes standard output.
Examples:
gawk '{ sum += $1 }; END { print sum }' file
gawk -F: '{ print $1 }' /etc/passwd
Sorry for not responding here. I appreciate wanting to swap out gawk and frawk in scripts where the program will otherwise run the same. I'll think about a replacement for '-b', and then publish a new version when I decide on one (suggestions welcome, of course). I'll probably get around to doing this once the other "low hanging fruit" bugs filed as issues are fixed.
Any update on this? -B
could be used instead of -b
.
Apologies! I should be able to make the substitution this weekend and post a new version.
I made the -b replacement. I can do others as well if you're running into other problems though.