[SunHELP] insert one line at beginning of text file; efficien tly

sunhelp at sunhelp.org sunhelp at sunhelp.org
Wed Sep 3 14:39:32 CDT 2003


Dale if you dont mind if I wanted to pass paramers ($1 $2 .....) to theis
perl
command how can I get it to go through without PERL trying to process the 
variable.  Appears the shell never gets to replace the variable value.

Example:
#! /bin/ksh
 OPTION=$1  # used variable OPTION here because first attempt with $1 didnt
work.
 perl -e 'print "${OPTION}\n"; while(<>){ print;}' < test.tmp > test.new

ouput shows a blank line at the beginning.


Thanks for your time.

-----Original Message-----
From: Dale Ghent [mailto:daleg at elemental.org]
Sent: Tuesday, September 02, 2003 7:59 PM
To: The SunHELP List
Subject: Re: [SunHELP] insert one line at beginning of text file;
efficiently


On Tuesday, September 2, 2003, at 05:51 PM, Markham, Richard wrote:

> This code will be intercepting print data which could be lengthy and
> that is why I am concerned with efficiency.  If I have to go with temp
> files I will add a time stamp to avoid multiple tasks overwritting
> each other.

perl -e 'print "\n"; while(<>){ print;}' < inputfile > outputfile

/ek
http://elektronkind.org/
Psytrance: it's post-grad school for ravers.
_______________________________________________
SunHELP maillist  -  SunHELP at sunhelp.org
http://www.sunhelp.org/mailman/listinfo/sunhelp



More information about the SunHELP mailing list