Ah, then what you really need to do this with is perl.

Edit in place, make backup copies or not, all very simple.

eg.  change all instances of SQLServer to Oracle in the files in a directory

perl -pi -e 's/SQLServer/Oracle/goi' *

Jared




"Ryan" <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]

 10/22/2003 08:59 PM
 Please respond to ORACLE-L

       
        To:        Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]>
        cc:        
        Subject:        Re: OT: How to call unix shell scripts from 'C'?



the basics are they i want 'C' so i can use a file pointer. I need to do
some search and replace in a group of files. If I use straight scripting I
have to redirect the output to a new file and do a 'mv' to rename it back.

with the filepointer, I was hoping to be to use fopen in C to open the file
and then manipulate it with search and replace.

not sure its possible. I Think you run into the same 'random access' issues
you do in java. im pretty weak in C programming.
----- Original Message -----
To: "Multiple recipients of list ORACLE-L" <[EMAIL PROTECTED]>
Sent: Wednesday, October 22, 2003 12:14 PM


> If you want the "C" program and the spawned shell script to
> "interact" and communicate back and forth with each other,
> then you'd have to use the "pipe()" system call to set up a
> two-way interprocess-communication pipe in the "C" program,
> then call "fork()" to spawn a new identical process
> (including the IPC pipes), then finally "exec()" in the
> child process to bring the image of the desired shell
> running it's shell script in.  Of course, each port of "C"
> has variations on those basic function call (i.e. "exec()"
> can be "execv()", "execve()", "execle()", etc).
>
> If you're just going to have the "C" program spawn the shell
> script that will operate independently of its parent, you
> can just call the "system()" library call and be done with
> it...
>
> Hope this helps...
>
> -Tim
>
>
> > The unix and C forums are pretty inactive. Hope its ok to
> > ask this here.
> > Anyone know how to do this?
> >
> > --
> > Please see the official ORACLE-L FAQ:
> > http://www.orafaq.net --
> > Author: <[EMAIL PROTECTED]
> >   INET: [EMAIL PROTECTED]
> >
> > Fat City Network Services    -- 858-538-5051
> > http://www.fatcity.com San Diego, California        --
> > Mailing list and web hosting services
> > ----------------------------------------------------------
> > ----------- To REMOVE yourself from this mailing list,
> > send an E-Mail message to: [EMAIL PROTECTED] (note
> > EXACT spelling of 'ListGuru') and in the message BODY,
> > include a line containing: UNSUB ORACLE-L (or the name of
> > mailing list you want to be removed from).  You may also
> > send the HELP command for other information (like
> > subscribing).
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.net
> --
> Author: Tim Gorman
>   INET: [EMAIL PROTECTED]
>
> Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
> San Diego, California        -- Mailing list and web hosting services
> ---------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from).  You may
> also send the HELP command for other information (like subscribing).
>

--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author: Ryan
 INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).


Reply via email to