HP3000-L Archives

February 2006, Week 4

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Dave Powell, MMfab" <[log in to unmask]>
Reply To:
Dave Powell, MMfab
Date:
Thu, 23 Feb 2006 12:49:18 -0800
Content-Type:
text/plain
Parts/Attachments:
text/plain (43 lines)
Maybe someone can help me with a command-file trick ?

I'm working on a command file where it would help to have it copy part of
itself into
a separate (temporary) file.  I originally thought I could use something like:

!PRINT   $STDINX     >   tempfile
1st line of temp file
...
last line of temp file
!EOD
next real command in the command-file

I've done this zillions of time in jobs, but inside a cmd-file it tries to
take lines from the terminal, not the lines following the print command in the
command-file.  Pseudo-random experiments like taking out the "$stdinx" didn't
help.

I have a workaround:

print  !hpfile;  start = 1st-line#-to-copy  >  tempfile

This works (with the part I want to extract at the end of the file, which is
ok), but the methods I have used to determine the line# to start with are so
barbaric I want keep looking for another approach.  (Hard-wiring the start
line# won't win maintainability prizes, but having the command-file read
itself to scan for the 1st line that belongs in the temp file is SLOOOOW).

Echo command would work for a shorter file, but this one will be several
hundred lines long, and may contain echo-unfriendly characters like ! >, etc.
I'll do anything rather than type "echo line-1 etc etc >> tempfile" a few
hundred times, carefully putting extra ! in front of any toxic characters.

Is there a way to rescue the approach at the top, or otherwise quickly and
elegantly have the command file extract part of itself without having to
specify a starting line ?  Ideally it would be pure-mpe -- I don't want to
make many assumptions about other software on the systems this might run on.

Dave (testing with hardwired line#) Powell,  MMfab

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2