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

sunhelp at sunhelp.org sunhelp at sunhelp.org
Tue Sep 2 20:04:24 CDT 2003


Fair enough.  It will be coming from reports generated from an Oracle
concurrent
manager.  Basically sqlplus reports derived from an Oracle database.  Text
files
will be created and sent to printer which could range from 1 page to a
~rare~
couple hundred of pages.  I dont expect them to be very large but the 
occurence of them will be relatively high.   The need for the modication of
the
output is derived from a print solution called Formscape which already
parses
and formats the text files before the final print.  I will be intercepting
the
jobs and using the added text to further enhance our abilities with running
Oracle and Formscape.  I like the perl idea that Dale Ghent recommended so
far. 

Thanks for your offer to assist.


-----Original Message-----
From: Phil Stracchino [mailto:alaric at caerllewys.net]
Sent: Tuesday, September 02, 2003 6:11 PM
To: 'sunhelp at sunhelp.org'
Subject: Re: [SunHELP] insert one line at beginning of text file;
efficiently


On Tue, Sep 02, 2003 at 05:51:34PM -0400, Markham, Richard wrote:
> I need to insert a line at the beginning of text files and would like to
> know if the following would be the most efficient way of doing so.
> 
> $ cat test.txt
> This is the original test data. 
> $ echo "new line" > tmp.new
> $ cat test.txt >> tmp.new
> $ mv tmp.new test.txt
> $ cat test.txt
> new line
> This is the original test data.
> 
> 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.

Is this a one-time job, or an ongoing thing?  Where does the original
test.txt come from?

This is probably a very inefficient way to do it, yes.  But it's hard to
be able to pick a more efficient one without knowing more about what
you're doing.



-- 
 .*********  Fight Back!  It may not be just YOUR life at risk.  *********.
 : phil stracchino : unix ronin : renaissance man : mystic zen biker geek :
 :  alaric at caerllewys.net : alaric-ruthven at earthlink.net : phil at latt.net  :
 :   2000 CBR929RR, 1991 VFR750F3 (foully murdered), 1986 VF500F (sold)   :
 :    Linux Now!   ...Because friends don't let friends use Microsoft.    :
_______________________________________________
SunHELP maillist  -  SunHELP at sunhelp.org
http://www.sunhelp.org/mailman/listinfo/sunhelp



More information about the SunHELP mailing list