Path: news.mitre.org!blanket.mitre.org!philabs!newsjunkie.ans.net!newsfeeds.ans.net!news-was.dfn.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cpk-news-hub1.bbnplanet.com!su-news-hub1.bbnplanet.com!news.bbnplanet.com!news.Stanford.EDU!nntp.Stanford.EDU!sldb4.slac.stanford.edu!fairfield From: fairfield@sldb4.slac.stanford.edu Newsgroups: comp.os.vms Subject: RE: multiple file "changeall" that works with LONG lines Date: 13 Jan 98 17:51:00 -0800 Organization: Stanford Linear Accelerator Center Lines: 102 Message-ID: <1998Jan13.175100.1@sldb4.slac.stanford.edu> References: <5103E59F620FD11198A100A024D380AA0F73DA@darthvader.synergex.com> NNTP-Posting-Host: sldb4.slac.stanford.edu Bravo for Nigel's solution, but he made a small typo: In article <5103E59F620FD11198A100A024D380AA0F73DA@darthvader.synergex.com>, Nigel White writes: > On Tuesday, January 13, 1998 12:43, mathog@seqaxp.bio.caltech.edu > [SMTP:mathog@seqaxp.bio.caltech.edu] wrote: [...] >> >400 characters, which choke EDT. At the moment I need to be able to >> replace >> >> .doc.html -> _doc.html >> >> and ignore any case differences when searching for the former. [...] > You can PROGRAM your TPU based editor to do anything. Quit using EDT > NOW!!!!! > > ;-) > > $ set noverify > $ if (p1 .eqs. "") > $ then > $ write sys$output "Please suppply filespec" > $ exit > $ endif > $ last_filename = "" > $ > $DIR_LOOP: > $ > $ file = f$search(p1) > $ filename = f$parse(file,,,"name") + f$parse(file,,,"type") > $ if (file .eqs. "") .or. (filename .eqs. last_filename) then exit > $ call FIX_FILE > $ last_filename = filename > $ goto DIR_LOOP > $ > $FIX_FILE: subroutine > $ > $ set message/nofacility/noidentification/noseverity/notext > $ edit/tpu/nodisplay/noinit/nosection/command=sys$input 'file' > ! > ! > > variable old, new, file_name, main_buff, old_pos; > > old: = "doc.html"; ^^^^^^^^^ The search string should include a leading dot: old := ".doc.html"; > new: = "_doc.html"; > file_name := get_info(command_line,"file_name"); > main_buff := create_buffer("MAIN", file_name); > > position(beginning_of(main_buff)); > loop > old_pos := search_quietly(old, forward, no_exact); > exitif (old_pos = 0); > position(old_pos); > erase(old_pos); > copy_text(new); > endloop; > > exit; > $EOD > $ set message/facility/identification/severity/text > $ exit > $ endsubroutine Let me just add that I prefer to do the file looping within TPU to suppress unnecessary image activations. You can prompt from withing the TPU procedure, but you can equally well supply the (wildcarded) file spec on the EDIT/TPU command line and retrieve it within the procedure via something like: file_spec := Get_Info (COMMAND_LINE, "file_name") The loop over files would be something like: next_file := ""; Loop next_file := File_Search (file_spec); Exitif next_file = ""; ... Endloop; -Ken -- Kenneth H. Fairfield | Internet: Fairfield@Slac.Stanford.Edu SLAC, P.O.Box 4349, MS 46 | DECnet: 45537::FAIRFIELD (45537=SLACVX) Stanford, CA 94309 | Voice: 650-926-2924 FAX: 650-926-3515 ------------------------------------------------------------------------- These opinions are mine, not SLAC's, Stanford's, nor the DOE's...