develooper Front page | perl.beginners | Postings from February 2002

In-line editing..

Thread Next
From:
Steven M. Klass
Date:
February 6, 2002 20:28
Subject:
In-line editing..
Message ID:
perl.beginners-19504@nntp.perl.org
Hi all,

	Here is the general problem.  I have a file that I need to edit but can't.  
That file is then fed into another program.  Think of the file that I want to 
edit is like a makefile, that I want to use after I tweak it a bit.  The 
general idea would be:
1) Find out what needs to be edited in FILE - DONE
2) Open file and read in the contents.  While those are being read in compare 
the stuff to be edited looking for the flags.  I'm thinking some standard 
search and replaces? - DONE (I THINK:))
3)  Now after my edits have been inputed, how do I automatically invoke my 
app using this new "buffer"  - HELP!!

Here is what I think I need :

<snip>   
my $APP ="/bin/someapp"
open (FILE, "file.txt") || die "Can't access file\n"; 
while (<CELL>) {
    s/INPUT\ FILE.*/INPUT\ FILE\ $VARIABLE/; 
	#replace the default with my option
    }

$APP CELL &; #<<-- This is just a guess??  Basically disconnect and run?    
<snip>

Is this the right idea?  Is there a better way to do this??  Can someone 
complete this picture for me, I would really appreciate it


-- 

 Steven M. Klass
 Physical Design Manager

 National Semiconductor Corp
 7400 W. Detroit Street
 Suite 170
 Chandler AZ 85226

 Ph:480-753-2503
 Fax:480-705-6407

 steven.klass@nsc.com
 http://www.nsc.com


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About