Can someone help me fix this? I know I am on the right track (I hope)
but not sure where I am going south



open FILE, "$g_logpass";
$line = <FILE>;
close (FILE);
chomp($line);
system("cp ../input/$g_logpass ../input/tmp.scr");
system("sed -e 's/'$line'/'$db_name'/g' ../input/tmp.scr > $g_logpass");


> -----Original Message-----
> From: Yacketta, Ronald 
> Sent: Tuesday, January 08, 2002 11:11
> To: Yacketta, Ronald; '[EMAIL PROTECTED]'; Yacketta, Ronald
> Cc: 'Beginners (E-mail)'
> Subject: RE: pull line #1 from a file
> 
> 
> would this be valid? or should I seek out a cleaner way?
> 
> system("sed -e 's/'chomp($lines[0])'/'$db_name'/g' 
> ../input/tmp.scr > $g_logpass");
> 
> just looking to replace line one in the file with a user 
> supplied value. I have like
> 23 files to parse and change per run based on user input.
> 
> 
> 
> > -----Original Message-----
> > From: Yacketta, Ronald 
> > Sent: Tuesday, January 08, 2002 11:06
> > To: [EMAIL PROTECTED]; Yacketta, Ronald
> > Cc: Beginners (E-mail)
> > Subject: RE: pull line #1 from a file
> > 
> > 
> > so so close...
> > I had this
> > 
> > 
> > OPEN(FILE, "< $g_all_sleepy);
> > @lines = <FILE>;
> > CLOSE(FILE);
> > $lines[0]; # think this is right, its an array.. all arrays 
> > start at 0 not 1.. unless
> >             # perl is funky and dont ;)
> > 
> > 
> > > -----Original Message-----
> > > From: Casey West [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, January 08, 2002 10:56
> > > To: Yacketta, Ronald
> > > Cc: Beginners (E-mail)
> > > Subject: Re: pull line #1 from a file
> > > 
> > > 
> > > On Tue, Jan 08, 2002 at 10:50:51AM -0500, Yacketta, Ronald wrote:
> > > :
> > > :Folks,
> > > :
> > > :need some minor help here.. been looking in the Cookbook for 
> > > an example
> > > :to pull the first line from a file..
> > > 
> > >   open FILE, "filename" or die $!;
> > >   my $line = <FILE>;
> > >   close FILE;
> > > 
> > > Remember, <FILEHANDLE> is something you can iterate over. 
>  In scalar
> > > context it returns just one line (for all intents and 
> purposes) at a
> > > time.
> > > 
> > >   Casey West
> > > 
> > > -- 
> > > Usenet is like Tetris for people who still remember how to read. 
> > >   -- Button from the Computer Museum, Boston, MA
> > > 
> > 
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to