Todd wrote: > > I tried to simplify a couple of things when I sent out the first email to > make it easier for help. Sorry for the type-o. The single quotes wont work > with this though: > > $hexval="011884455667733"; > $newval='hba0-SCSI-target-id-7-name="$hexval"'; > @output = `/usr/bin/perl -p -i -e > "s/hba0-SCSI-target-id-1-name=(.*)/$newval/;" /kernel/drv/qla2300.conf`; > > becuase I neglected to tell you I am using a variable name in there as well > ($hexval). > > How can I get the string: > > hba0-SCSI-target-id-7-name="011884455667733" > > to appear in my qla2300.h file? That s/old/new command will not put my > quotes in the file??
Untested: local ( $^I, @ARGV ) = ( '', '/kernel/drv/qla2300.conf' ); while ( <> ) { s/(?<=hba0-SCSI-target-id-1-name=")[^"]*(?=")/$hexval/; print; } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>