TIP: Click on subject to list as thread! ANSI
echo: 4dos
to: Claus Mueller
from: Tony Pater
date: 1998-11-01 13:42:10
subject: Testing for String in File ?

-=> Quoting Claus Mueller to Tony Pater <=-


 CM> Hallo Tony,

  Wei gehtes Claus,

 CM> why don't you use a FFind to find out which file contains the
 CM> information you need. Just write Filenames (of found files) 
 CM> to a file you use for input to your fileopen part?

 It had ocurred to me .... but for a couple of reason it isn't
 my preferred route to the solution....
 Apart from the explanation about the REXX solution in another
 message (needed a sort off menu glue around the routine(s),
 I wanted to do it on Ramdisk as the processing is primarily
 on mail which is encrypted.... so the original wai/is to
 stay on hard disk, but the opening/viewing/processing/etc is
 to take place on Ramdisk .... I didn't want to create un-necessary
 lists of those affected files & their contents.
 
 TP>   Using 'FindFirst' can use wildcards & attributes - would
 TP>   that be the way to tackle the search for a file to be
 TP>   opened given that it is a randomnly generated filename ?

 CM> Otherwise you have to do a Findfirst/findnext to get a filename that
 CM> can be processed by fileopen.

 OK........
 
 TP>     . check that a file(s) within a folder(s) contain
 TP>       a string (ie. I wish to test for 'BFE' in the first
 TP>       line of the file(s) ..... before using a 'goto' ?

 CM> ffind /bt"BFE" *.* >> $$dx
 CM> for %a in ({at}$$dx) do gosub dowhatever
 CM> del /q $$dx
 CM> quit 0

 CM> :dowhatever
 CM> set dx=%{at}fileopen[%a,read]
 CM> .....
 CM> %{at}fileclose[%dx]
 CM> return

 Ah ..... that's sounds about right Claus, thanks.
 
 TP>   An example of how you handle/check/test for a string in
 TP>   an opened file would be much appreciated.

 CM> If I would do it with the commands findfirst/findnext, fileopen,
 CM> fileread, stringcompare, fileclose it should look like the following:

 CM> Now it's your turn again.

 

 Ok ..... got some of that .... I do have [registered] the latest
 version of 4dos/4os2 .... so the latter code wasn't require, but
 thanks for showing it as it'll help me understand some of the
 first coding you sent (for current 4dos/4os2).

 I've set myself a fairly complicated task here as not only is there
 the need to have a menu presented in front of each message as it's
 invoked (PM programme), but then a choice of actions (as described
 here and partly in in another posting).. hence maybe I'll do some
 background processing per your suggested script(s), to test it out,
 but then i/f it with REXX stuff for the PM i/f.
 Presently .... I'm doing things manually, but as last month I had
 to contend with 30+ megs of data in some 3000+ emails, it's 
 exploded to the point where automation is mandated.

 I've just bought a couple of books on REXX, so once I've got a
 working 4os2 solution (minus the PM i/f menu) .... I'll get into
 seeing what PM programming with some PM rexx tools can give.

 FWIW ..... The data is on the 'Asian Crisis' + private Think Tank
 forums out of Japan/China/Taiwan/Singapore ..... so time I don't have?

 OK ..... gotta go ....and BIG thanks for your suggestions/thoughts.

 Oh yeh ..... one last thing ..... IBM sent me the Beta of their
 new OS/2 Warp Server SMP (codename 'Aurora'), so I'm awaiting
 a new behemoth to put it on ..... then I'll flick off to London/
 /Paris/Berlin/Vienna/Budapest for a break from the financial
 storm that's causing me so much work .... these 'so-called'
 gurus couldn't organise a piss-up in a brewery.... and they've
 cost every taxpayer in the G7 billions ..... dumkopfs !

 Ciao
 Tony
 Sydney, Oz
 Mon 02/11/1998  0:08:51  



... 4dos/4os2.. under Warp 4
--- FMail/2 1.22+
* Origin: Cyberia: You know you want it. [02-9534-1702] (3:712/848)
SEEN-BY: 396/1 632/0 371 633/260 267 270 371 635/506 728 639/252
@PATH: 712/848 888 311 640/201 270/101 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.