[REBOL] Re: [AWK GREP] AWK and GREP funcs, arg order
From: gregg::pointillistic::com at: 17-May-2007 17:51
Hi Anton,
AR> Can you give some examples of typical arguments for your
AR> AWK and GREP ? Then we can consider various orders.
rgrep/deep "REBOL" %*.r
rgrep "my-func" %my-lib.r
rawk %*.r [(find __ "REBOL") [print [_filename _fnr]]
rawk/deep %*.r [(find __ "REBOL") [print [_filename _fnr]]]]
rawk/deep %*.r [
(find __ "REBOL")
[print [second split-path filename _fnr copy/part __ 20]]
]
files: file-list/deep %*.r
rawk files [
(find __ "REBOL")
[print [second split-path filename _fnr copy/part __ 20]]
]
files: file-list/deep %*.r
prog: [
(find __ "REBOL") [
print [second split-path filename _fnr copy/part __ 20]]
]
rawk files prog
Both AWK and GREP take the program/pattern first. I did that for both
of mine originally, then changed RAWK to take the sources first, which
I think I prefer. They could both eventually load their program or
pattern specs from disk, and files can be a single name, a block of
files, a file spec (glob), or a variable.
Are we applying the program to the files, or the files to the program?
-- Gregg