I need to parse a file that has the following formatted data and get the
DIRNAME for the OTHER node.
CLASS=
(SOURCE=
(TYPE=FILE)
(DEFAULT=
(DIRNAME=${HOME}/information/logs)
)
)
OTHER=
(SOURCE=
(TYPE=FILE)
(DEFAULT=
(DIRNAME=${HOME}/site/location)
)
)
STUDENT=
(SOURCE=
(TYPE=FILE)
(DEFAULT=
(DIRNAME=/opt/students)
)
)
I have to capture everything that is contained in the OTHER= field, like
so:
OTHER= <whitespace> ( <to capture> )
and then I have to capture everything that is within the DIRNAME in the
OTHER= field, like so:
(DIRNAME=<to capture>)
I would like to do this in a sort of robust script that can run in most
unix systems, anyone know what command line tools I should use for this
and what sort of regular expressions would I need to capture the data in
the way I have outlined.
Any help appreciated,
Ted
see the test below:
note that there was an empty line above output line ${HOME}/site/location,
it was the whitespace after
OTHER=