Re: recursive awk

Manuel Collado <[email protected]> Sun, 20 Dec 2009 11:14:16 +0100
Newsgroups gmane.comp.gnu.utils
Organization RedIRIS
Message-ID <[email protected]>
Mathieu escribió:
> I wanted to write an awk script to generate an dep list for a latex
> file. So I need to match \input{a} and run the same script on a.tex.
> 
> The question is how to do awk recursively?

Add "a.tex" to the ARGV array, if not already there:

BEGIN { copy ARGV to dep }

/\\input/ {
    extract file module name = "somename.tex"
    if (!(name in dep)) { add name to ARGV, update ARGC }
}

END {
    for (name in dep) { print name }
}

-- 
Manuel Collado - http://lml.ls.fi.upm.es/~mcollado