LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Append file name to line in formsweb.cfg Oracle IAS (https://www.linuxquestions.org/questions/linux-newbie-8/append-file-name-to-line-in-formsweb-cfg-oracle-ias-715482/)

franjo124 03-30-2009 07:55 AM

Append file name to line in formsweb.cfg Oracle IAS
 
I'm writing script for installing patch for end user application.
Among others I have to update Oracle IAS configuration file. In cfg file are strings :
archive_jini=frmall_jinit.jar,...,some.jar
archive=frmall.jar,...,some.jar
When patch brings an archive file for java, it has to be listed here.
some.jar has to be appended to both lines if it is not present and has to be ignored if it is present in listing of jar files.

I wish to use sed editor in manner
sed -f mysedcommands formsweb.cfg > formsweb.cfg_new

I'm using GNU sed version 4.1.5 on Centos 5.2 platform

If there is someone who enjoys in helping I would appreciate help

:D


Regards
Franjo

Tinkster 03-30-2009 10:49 AM

Assuming that each line appears only once and that the
archive bits are always at the beginning of the line...

Code:

/^archive_jini=/ s/$/,some.jar/
/^archive=/ s/$/,some.jar/


franjo124 03-31-2009 05:39 AM

Good day.

First : Thank you for replaying

Second: Your observation was correct. Each addresses archive_jini and archive are unique as it should be in conf file.

Third : Appending file name is fine if and only if we do it for the first time. When SW developer is producing update of that file we shouldn't append it again. Nothing wrong if we have :
archive_jini=frmall_jinit.jar,...,some.jar,some.jar,some.jar,next.jar,some.jar
but it is not what I wish, it is ugly and I don't like it.

Just got idea : double substitution first file name with null second new line with file name
:D

All I need now is knowledge how to write the code and incorporate it in script

Thanks again
Regards
Franjo


All times are GMT -5. The time now is 01:50 AM.