LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-30-2009, 07:55 AM   #1
franjo124
LQ Newbie
 
Registered: Mar 2008
Posts: 14

Rep: Reputation: 0
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




Regards
Franjo
 
Old 03-30-2009, 10:49 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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/
 
Old 03-31-2009, 05:39 AM   #3
franjo124
LQ Newbie
 
Registered: Mar 2008
Posts: 14

Original Poster
Rep: Reputation: 0
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


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

Thanks again
Regards
Franjo
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash programming-append single line to end of file pheasand Linux - General 4 02-28-2014 09:41 AM
Sed append text to end of line if line contains specific text? How can this be done? helptonewbie Linux - Newbie 4 10-23-2013 01:48 PM
Attempting to append a line of text to the end of the previous line market_garden Linux - General 4 12-11-2008 11:37 AM
append a line to text file in script roadrash Linux - Newbie 4 10-01-2008 09:03 AM
timidity.cfg syntax error in first line... Simon Bridge Linux - Software 0 04-25-2004 09:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration