Thread View: vmsnet.tpu
3 messages
3 total messages
Started by frank Chip Dyer x9568 ..Electric...
Fri, 20 Nov 1992 13:13
How to EDIT files via a COMMAND FIle
Author: frank Chip Dyer x9568 ..Electric...
Date: Fri, 20 Nov 1992 13:13
Date: Fri, 20 Nov 1992 13:13
27 lines
1822 bytes
1822 bytes
EVE/TPU experts:
I have about 50 files with the number "100C000" (hexadecimal) in them. I
need to edit all these files and replace "100C000" with "1010000." Is it
possible to do this through a non-interactive (automatic) process?
Ideally I want to have a COMMAND procedure do a GLOBLAL REPLACE on
"100C000" - something like
$ EDIT/TPU/NOINIT/NODISplay/COMmand=SYS$INPUT in.src/OUTput=OUT.SRC
EVE_REPLACE("100A","*!!*!!**")
$ EXIT
Is this possible? I have never written or used any TPU procedures, so
any help you can provide will greatly be appreciated. I use EVE quite a
bit, but as far as writing or using TPU procedures, I have never done
that.
Thanx, Frank
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
* Frank Dyer INTERNET: DYERFDF@HSDWL.UTC.COM *
* Hamilton Standard (UTC Division) (203) 683-9568 FAX: 683-9500 *
* Senior Design Engineer *
* Windsor Locks, CT USA Nuthin' Witty to write here Yet! *
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Re: How to EDIT files via a COMMAND FIle
Author: Carl J Lydick
Date: Sat, 21 Nov 1992 00:14
Date: Sat, 21 Nov 1992 00:14
37 lines
2225 bytes
2225 bytes
In article <01GRDAR6Q8RM001XBD@utrcgw.utc.com>, "frank (Chip) Dyer x9568 ..Electrical Design" writes:
> EVE/TPU experts:
>
> I have about 50 files with the number "100C000" (hexadecimal) in them. I
> need to edit all these files and replace "100C000" with "1010000." Is it
> possible to do this through a non-interactive (automatic) process?
>
> Ideally I want to have a COMMAND procedure do a GLOBLAL REPLACE on
> "100C000" - something like
>
> $ EDIT/TPU/NOINIT/NODISplay/COMmand=SYS$INPUT in.src/OUTput=OUT.SRC
> EVE_REPLACE("100A","*!!*!!**")
> $ EXIT
>
> Is this possible? I have never written or used any TPU procedures, so
> any help you can provide will greatly be appreciated. I use EVE quite a
> bit, but as far as writing or using TPU procedures, I have never done
> that.
$ EDIT/TPU/NODISPLAY/NOSECTION/COMMAND=SYS$INPUT: in.src/OUTPUT=out.src
POSITION(CREATE_BUFFER('',GET_INFO(COMMAND_LINE,'FILE_NAME')));
LOOP R := SEARCH("100C000", FORWARD);
EXITIF R=0;
POSITION(R);
ERASE(R);
COPY_TEXT("1010000");
ENDLOOP;
WRITE_FILE(CURRENT_BUFFER, GET_INFO(COMMAND_LINE,'OUTPUT_FILE'));
EXIT;
--------------------------------------------------------------------------------
Carl J Lydick | INTERnet: CARL@SOL1.GPS.CALTECH.EDU | NSI/HEPnet: SOL1::CARL
Disclaimer: Hey, I understand VAXen and VMS. That's what I get paid for. My
understanding of astronomy is purely at the amateur level (or below). So
unless what I'm saying is directly related to VAX/VMS, don't hold me or my
organization responsible for it. If it IS related to VAX/VMS, you can try to
hold me responsible for it, but my organization had nothing to do with it.
Re: How to EDIT files via a COMMAND FIle
Author: Brian J. McCarthy
Date: Mon, 23 Nov 1992 11:35
Date: Mon, 23 Nov 1992 11:35
106 lines
5120 bytes
5120 bytes
In article <1ejv1aINNeqa@gap.caltech.edu>, carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick) writes...
>In article <01GRDAR6Q8RM001XBD@utrcgw.utc.com>, "frank (Chip) Dyer x9568 ..Electrical Design" writes:
>> EVE/TPU experts:
>>
>> I have about 50 files with the number "100C000" (hexadecimal) in them. I
>> need to edit all these files and replace "100C000" with "1010000." Is it
>> possible to do this through a non-interactive (automatic) process?
>>
>> Ideally I want to have a COMMAND procedure do a GLOBLAL REPLACE on
>> "100C000" - something like
>>
>> $ EDIT/TPU/NOINIT/NODISplay/COMmand=SYS$INPUT in.src/OUTput=OUT.SRC
>> EVE_REPLACE("100A","*!!*!!**")
>> $ EXIT
>>
>> Is this possible? I have never written or used any TPU procedures, so
>> any help you can provide will greatly be appreciated. I use EVE quite a
>> bit, but as far as writing or using TPU procedures, I have never done
>> that.
>
>$ EDIT/TPU/NODISPLAY/NOSECTION/COMMAND=SYS$INPUT: in.src/OUTPUT=out.src
>POSITION(CREATE_BUFFER('',GET_INFO(COMMAND_LINE,'FILE_NAME')));
>LOOP R := SEARCH("100C000", FORWARD);
> EXITIF R=0;
> POSITION(R);
> ERASE(R);
> COPY_TEXT("1010000");
>ENDLOOP;
>WRITE_FILE(CURRENT_BUFFER, GET_INFO(COMMAND_LINE,'OUTPUT_FILE'));
>EXIT;
>--------------------------------------------------------------------------------
>Carl J Lydick | INTERnet: CARL@SOL1.GPS.CALTECH.EDU | NSI/HEPnet: SOL1::CARL
>
This works great when you know exactly what you want to replace and want to
hard code it into the command procedure. I sent something out to info-tpu
mailing list and I will post it here. It creates a temporary TPU command file
that senses wildcard searches.
I just did some quick hand edits to the file without checking to see if it
still works (but it should...)
Here it is:
$! replace_wild.com
$!
$! generic replacement com file. Changes every occurance of P3 to P4
$! found in file P1 and writes it out to P2
$!
$! If p3 (the search string) contains a wildcard character ("*"), then
$! P5 contains what characters are to be matched for that wildcard character
$! For example:
$!
$! @replace_wild <input-file> <output-file> "export : '*';" -
$! $_ "export : 'V01-123';" "vx1234567890-"
$!
$! would cause the following strings
$! export : '';
$! export : 'Vx001-x55';
$! export : 'V1.0';
$! to be replaced with
$! "export : 'V01-123';"
$!
$ tmp_file = "sys$scratch:replace_wild.tmp"
$ open/write replace_cmd 'tmp_file
$ write replace_cmd "procedure global_replace (find_pat, repl_str, wild_chars);"
$ write replace_cmd "local found_wildcard,begin_str,end_str,search_pattern,r1;"
$ write replace_cmd "found_wildcard := index (find_pat, ""*"");"
$ write replace_cmd "if found_wildcard = 0"
$ write replace_cmd "then"
$ write replace_cmd " search_pattern := find_pat;"
$ write replace_cmd "else"
$ write replace_cmd " begin_str := SUBSTR (find_pat, 1, found_wildcard-1);
$ write replace_cmd " end_str := SUBSTR (find_pat, found_wildcard+1);
$ !
$ ! Create a pattern that starts with everything up to the wildcard and then
$ ! spans all the characters passed in to the command procedure in p5, then
$ ! ends with what ever follows the wildcard character
$ !
$ write replace_cmd " search_pattern := begin_str + (SPAN (wild_chars) | """") + end_str;"
$ write replace_cmd "endif;"
$ write replace_cmd "position (beginning_of (current_buffer));"
$ write replace_cmd "loop"
$ write replace_cmd " r1 := search_quietly (search_pattern, forward, no_exact);"
$ write replace_cmd " if r1 = 0 then return; endif;"
$ write replace_cmd " position (r1);"
$ write replace_cmd " erase (r1);"
$ write replace_cmd " copy_text (repl_str);"
$ write replace_cmd "endloop;"
$ write replace_cmd "endprocedure;"
$ write replace_cmd "!"
$ write replace_cmd "b1 := create_buffer (""b1"", get_info(command_line,""file_name""));"
$ write replace_cmd "position (b1);"
$ write replace_cmd "global_replace (""''P3'"", ""''P4'"", ""''p5'"");"
$ write replace_cmd "write_file (b1, get_info(command_line, ""output_file""));"
$ write replace_cmd "quit (off, 1); "
$ close replace_cmd
$ EDIT/TPU/NODISP/NOSECT/NOINIT/COMMAND='tmp_file' -
/output='P2 'P1
$ !
$ delete 'tmp_file';
********************************************************************************
Brian J. McCarthy DECTPU/EVE Engineering Project Leader
Digital Equipment Corporation Nashua, NH
********************************************************************************
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads