You are not logged in.

#1 2009-01-22 01:08:40

mikesd
Member
From: Australia
Registered: 2008-02-01
Posts: 788
Website

[SOLVED] dynamic system documentation

I'm currently trying to come up with some system documentation that can be dynamically updated. Ideal usage would be to have a template file and a Makefile in a directory and be able to just type make to update my system documentation. A template file would look something like but be more complicated obviously:

Output of ifconfig:

%% ifconfig %%

The %% ifconfig %% would be replaced by the output of the command, in this case ifconfig.

I could do this in python but would like something just requiring the basic built in utilities, sed, awk, etc and a makefile.

Has anyone done something similar or knows how I might do this?

This:

test.txt: test.template
        sed 's/%%\(.*\)%%/\1/' <test.template >test.txt

is as close as I can get with sed. Backticks don't seem to work inside the 's/../../' expression but maybe there is another way?

Regards,

Mike

Last edited by mikesd (2009-01-22 03:14:01)

Offline

#2 2009-01-22 03:13:16

mikesd
Member
From: Australia
Registered: 2008-02-01
Posts: 788
Website

Re: [SOLVED] dynamic system documentation

Looks like m4 is what I'm after. It will do the job with a slightly different input format for commands.

Offline

Board footer

Powered by FluxBB