[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1. What is LibTemplate


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1 Description

LibTemplate is a template library for c. It is both a command line program called template, and a c template API.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2. Command Line (template)


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.1 act like sed

 
$ echo foo | template -r /foo/bar/
bar


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2 act like perl

 
$ echo XX123YY | template -r /[A-Z]*([0-9]*)[A-Z]*/number:$1/
number:123


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3 replace matches in template.txt to out.txt

 
$ template -r /foo/bat -o out.txt template.txt


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.4 replace within in same file and backup to filename.txt~

 
$ template -i -r /foo/bat filename.txt 


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.5 template substitutions

 
$ echo This is a template by ${author} | template -k author=sean
This is a template by sean


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.6 lists

 
$ echo '${list:} ${list.a} + ${list.b} = ${list.c} ${:list}' \
				| template -l list:a=one,b=two,c=three|a=four,b=five,c=nine
one + two = three
four + five = nine


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3. More Info


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1 Links

More information can be found at savannah libtemplate


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Concept Index


[Top] [Contents] [Index] [ ? ]

Table of Contents

1. What is LibTemplate
1.1 Description
2. Command Line (template)
2.1 act like sed
2.2 act like perl
2.3 replace matches in template.txt to out.txt
2.4 replace within in same file and backup to filename.txt~
2.5 template substitutions
2.6 lists
3. More Info
3.1 Links
Concept Index

[Top] [Contents] [Index] [ ? ]

Short Table of Contents

1. What is LibTemplate
2. Command Line (template)
3. More Info
Concept Index

[Top] [Contents] [Index] [ ? ]

About this document

This document was generated using texi2html

The buttons in the navigation panels have the following meaning:

Button Name Go to From 1.2.3 go to
[ < ] Back previous section in reading order 1.2.2
[ > ] Forward next section in reading order 1.2.4
[ << ] FastBack previous or up-and-previous section 1.1
[ Up ] Up up section 1.2
[ >> ] FastForward next or up-and-next section 1.3
[Top] Top cover (top) of document  
[Contents] Contents table of contents  
[Index] Index concept index  
[ ? ] About this page  

where the Example assumes that the current position is at Subsubsection One-Two-Three of a document of the following structure:

This document was generated by Sean McEligot on October, 24 2002 using texi2html