[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to parse sections in INI-file? (existing tool?)



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

Attachment: pgprOcbTLxpkU.pgp
Description: PGP signature


Reply to: