1 Jun 2004 01:26
Re: How to parse sections in INI-file? (existing tool?)
Bob Proulx <bob <at> proulx.com>
2004-05-31 23:26:33 GMT
2004-05-31 23:26:33 GMT
Rudi Effe wrote:
> I plan to interpret / convert an ini-file like this:
>
> [SECTION 1]
> property 1 = value 1
> property 2 = value 2
> property 3 = value 3
>
> [SECTION 2]
> property 1 = value 4
> ...
>
> [...]
> Any hints welcome
You said any hints. Not suggesting this is the best way. But for
single items it is not bad.
Using /bin/sh you can extract individual properties this way.
PROPERTY1=$(sed -n '/^\[SECTION 1\]/,/^$/{/property 1 = */s///p;}' cnffile)
Bob
RSS Feed