addtofile() function in IPCop's library.sh

"John Campbell" <security-zKENX0Cht/5n8C+U7lyxXlpr/1R2p/[email protected]>
Newsgroups gmane.comp.security.ipcop.devel
Message-ID <[email protected]>
Hi,

Was wondering if someone could help me out here with a bit of advice using
sed?

I have been taking a look at creating some basic installation packages for
some of my modifications, and looking in /usr/lib/ipcop/library.sh I can see
the addtofile() function.

Got this working fine where I only search for a string (or part of) from a
single line.

I notice that this function uses the command:

 

                sed -i -e "/${4}/ r addtofile" ${3}

 

which adds your content after the string you searched for.

 

Got two questions...

1)      How do I alter this function to add my content _before_ the string I
searched for?

2)      How can I search for a string that spans several lines, and
subsequently place my content before or after it?

 

Basically I want to get the addtofile function to be able to search for a
string pattern that may span several lines, and add a 5 paramter to specify
whether you want the section to be added before or after the position found.

 

Thanks in advance...

John Campbell

------------------------------------------------------------------------------
Get your Android app more play: Bring it to the BlackBerry PlayBook 
in minutes. BlackBerry App World&#153; now supports Android&#153; Apps 
for the BlackBerry&reg; PlayBook&#153;. Discover just how easy and simple 
it is! http://p.sf.net/sfu/android-dev2dev

_______________________________________________
IPCop-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ipcop-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.