I am working on a configuration file parser, written in a bash script. I am parsing a file where each line is in the form of
[comment][option title][comment]: [option value]
where [comment] is either " *[anything]* " or "". The problem is that egrep will find the lines I need, but sed will not remove the option tag for me.
Here is a simplified version of my script (sorry, no Linux here so I can't test it...):
if [ `egrep -c "$tag" "$file"` -ne 1 ]; then
egrep -h "$tag" "$file" | sed "s/$tag//"
echo "`extract \"extport_fs\"`"
(In case you can't tell, that is a space and a tab in mandspc.)
Here is the part of my config file applicable (file named ext-config):
* file system for extport * extport_fs: ext2
egrep can find the line just fine, however sed will not remove the "file system for extport * extport_fs: " from the line. Can you see anything I'm doing wrong as far as the regex? Is there something besides sed that I can use? It's still in "working" status, therefore I am going to change the style of the lines once I get it working. Thanks.
[EDIT] Made it a little more easy to read...