They're just people who need to write a bunch of repetitive C code for every new
feature and would like to generate it instead of write it. They're fairly
familiar with shell and awk but not at all familiar with perl.
> Other possibilities could be using tags or markers and pre-processing
> that enhanced awk script
>
> awk '
> ...awk script code goes here...
> HEREDOC+
> ...heredoc template
> inside tags...
> HEREDOC-
> ...awk script code goes here...
> '
>
>
> awk '
> ...awk script code goes here...
> #> ...heredoc template
> #> inside tags...
> ...awk script code goes here...
> '
Hmm, interesting possibility. I'll give that a try and see how it looks/works.
> But it's hard to know what your folks are willing to accept and what
> they refuse. With a strong emphasis on plain heredoc shell syntax I'd
> probably stick to shell anyway. Your people do need awk functionality
> as well?
I don't think awk has anything anyone _needs_ over shell, it just has some
useful features that make it a bit easier to use for text processing so it'd
save them some time/effort if they could write an awk script containing a here
document rather than a full shell script.
I'm not that familiar with perl, but perl supports both, awk
> functionality and shell heredoc functionality; ist that an option?
No, the people I work with don't know perl at all, it's not available on all of
the machines we use and we don't have permission to install it so perl is
definitely out. Plus, most importantly, perl syntax is icky :-).
> In case that the requirements are:
> + it must be based on awk and shell
Right.
> + it may not be shell alone
It could be shell alone. If it's just shell you lose some awk benefits in the
rest of the script, and if it's just awk you lose the here doc benefit of shell.
> + it may not be perl
Right.
> + it may not have interpreted pre-processing steps
That may be possible, depending how it works.
> + any awk part of the solution must conform to requirements: [unknown]
The only requirement is that the here doc part looks like a here doc in as much
as you can copy/paste a chunk of text from some other file into the script
without adding control constructs around every line (start/end quotes, trailing
backslashes, separate function calls, etc.).
> + it must be a clear programming pattern
Right.
> then I'll bite; I think there's no solution. If any of the requirements
> can be dropped, though...
>
> BTW, I seem to recall that there was already a thread about heredocs in
> awk (in c.l.a or in c.u.s) recently (last year, or so).
Yeah, that was probably me too. I had this issue back then as well and was never
really happy with the end result so I thought I'd give it one more try since the
subject just came up again at work.
Thanks for the suggestions, especially that pre-processing one. I'll post what I
come up with for more feedback.
Ed.