sergio masci wrote: >> I ended up writing an quick-and-dirty Python script after the original >> post, >> that does the above -- but surely there's got to be something >> off-the-shelf >> that can be used for the same purpose? >> >> Vitaliy > > Yes you could still do this in M4. The input file "file1.c" would become > > file1.txt: > function TOKEN { Nop(); } > > and you would process file "file1.c" for every line of file "file2.txt" > like this: > > patsubst(include(`cfile2.txt'), `\w+', `define(`TOKEN', `\&') > include(`cfile1.txt')') > > you would write the above statement into a file such as file1.m4 then > pass that to m4 as in: > > m4 file1.m4 >cfile1.c This looks interesting, pretty easy to figure out what's going on. Did you mean to say "include('file1.txt')" on the second line? At the risk of getting RTFMed (it's 2 am, can barely type), what's the \& for? Lazy/greedy? What other things do you find M4 to be useful for? Vitaliy -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist