Re: Question - reading command line parms inside a script.
From: Ken Andrews (gobble_at_degook.com)
Date: 03/11/04
- Next message: samuels_at_red.seas.upenn.edu: "Re: first 200 charactes of an EBCDIC file"
- Previous message: Ed Morton: "Re: UNIX Timing"
- In reply to: Chris F.A. Johnson: "Re: Question - reading command line parms inside a script."
- Next in thread: Chris F.A. Johnson: "Re: Question - reading command line parms inside a script."
- Reply: Chris F.A. Johnson: "Re: Question - reading command line parms inside a script."
- Reply: Nick Landsberg: "Re: Question - reading command line parms inside a script."
- Reply: John Savage: "Re: Question - reading command line parms inside a script."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 11 Mar 2004 14:37:10 GMT
"Chris F.A. Johnson" <c.fa.johnson@rogers.com> wrote in message
> Before we can diagnose the OP's problem any further, we need to
> know more about what he's doing, and what the problem is exactly.
Given:
1) Program (executable) called REFORMAT.exe, which takes a file and a set
of parms and builds a new file from it. Example:
reformat source.txt target.txt 1-20 -f=" >" 40-43 -f="< 40-43" -p122eqabc
73-87 -f=" " 21
The above will take all records from source where position 122 = a, b, or c
and copy characters 1-20, 40-43, 73-87, and 21 into the target file, while
putting " >", "< 40-43 ", and a space in the positions between the
selections. The output lines would look like:
xxxxxxxxxxxxxxxxxxxx >xxxx< 40-43 xxxxxxxxxxxxxxx x
2) New version of REFORMAT (different company) coming online that uses a
different set of command parms, particulars unimportant.
3) Several hundred scripts have REFORMAT commands built into them, with
lines such as in (1).
4) I'm trying to build a script called REFORMAT which will intercept the
commands. My script version of REFORMAT will invoke a program that will
decide if the given set of commands can be restructured and if so will do so
and build a script to execute the new program. If it cannot, then it must
fire the old version of REFORMAT and pass it the exact command strings as
they were written in the invoking script.
Example:
Script alpha has the command line in (1) built into it.
Script alpha now invokes the script REFORMAT.
Script REFORMAT invokes program CHECK with the above command parms.
CHECK decides whether or not it can convert the parms. If it can, it builds
a temporary script using the converted parms. If it cannot, it builds a
temporary script using the exact passed parms.
Script REFORMAT executes the temporary script.
CHECK must build the temporary script which invokes the original
REFORMAT.exe using the exact parms above. It must receive and pass on
-f=" >"
It cannot receive or pass on
-f= >
If it passes the first, REFORMAT.exe will see one parm. If it passes the
second, REFORMAT.exe will see one parm -f= and a second parm >.
Right now CHECK is seeing -f= >, which it's interpreting as 2 parms. This
gets very bad if it passes "< 40-43 " as 2 parms, as it will put in
replacement data rather than text.
Possibly I'm approaching this problem the wrong way (interception script
with rebuilder program). If there's another way of doing it, I'd be very
happy to know.
- Next message: samuels_at_red.seas.upenn.edu: "Re: first 200 charactes of an EBCDIC file"
- Previous message: Ed Morton: "Re: UNIX Timing"
- In reply to: Chris F.A. Johnson: "Re: Question - reading command line parms inside a script."
- Next in thread: Chris F.A. Johnson: "Re: Question - reading command line parms inside a script."
- Reply: Chris F.A. Johnson: "Re: Question - reading command line parms inside a script."
- Reply: Nick Landsberg: "Re: Question - reading command line parms inside a script."
- Reply: John Savage: "Re: Question - reading command line parms inside a script."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|