I have a program I wrote that will find just about any string in any file. I wrote it case sensitive, however, because we have to search that way 99% of the time. Since it's a program, you can modify it to be case insenstive and have the speed of the TCL SEARCH command with control. Don't we like control?
I've pasted it at the end of this email. It's 117 lines long and uses a few things specific to our system, such as SET.DIMENSIONS which reads the COLUMNS and LINES from the terminal and sets the UV environment to match, plus $include INC.KLP which has a few variables that should be self-explanatory as @(-N) commands commonly used. And, I hope it helps. Maybe it should be put on the WIKI? Karl <quote who="Peter Veenhof"> > Thanks Brian, that'll do the trick for what I'm after. Since I'm calling > from UONET I may be able to do a 'squawk' to a phantom piped output to a > file to pull record IDs as they are found when running this against any > seriously large tables. > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > [EMAIL PROTECTED] > Sent: Thursday, March 08, 2007 10:18 AM > To: u2-users@listserver.u2ug.org > Subject: RE: [U2] [UV] SEARCH command > > Peter > > Search is case sensitive. > The best case-insensitive equivalent (though slower) is to use a SELECT > command: > > SELECT yourfile WITH EVAL "UPCASE(@RECORD)" LIKE "...YOUR_PHRASE..." > > Brian > ------- <BEGIN FINDALL> 0001 !(FINDALL) - Search any file for input string 0002 ! Karl Pearson 0003 ! 02/09/2005 0004 $include INC.KLP 0005 0006 VARS = trim(@sentence) 0007 TLRT = dcount(VARS,' ') 0008 FL = field(VARS,' ',TLRT) 0009 SRCH = field(VARS,' ',2,TLRT-2) 0010 execute 'RUN BP SET.DIMENSIONS' ;! Set terminal Width & Height 0011 open EMP,'AR.CTL' to AR.CTL else stopm 'No AR.CTL File.' 0012 read REC from AR.CTL,"FINDALL" then 0013 USRNM = REC<1> 0014 if USRNM = @LOGNAME then 0015 print "You are running FINDALL. If you know you aren't, then type ATS and press <ENTER> to continue : ": 0016 input DOSLK 0017 if upcase(DOSLK) = 'ATS' then go ARNDIT 0018 end 0019 stopm USRNM:" is running FINDALL. Try again." 0020 end else 0021 write @LOGNAME on AR.CTL,"FINDALL" 0022 end 0023 ARNDIT: 0024 Y = 1 ; KEY = EMP ; CNT = 0 ; PCNT = 0 0025 BTM = @crthigh 0026 SPOT = @(0,BTM-4) 0027 SPTT = @(0,BTM-3) 0028 print @(-1) 0029 SRCH: if TLRT = 1 then 0030 print SPOT:' Enter Search String or E=End : ':CLSLN: 0031 input SRCH 0032 if SRCH = EMP then 0033 print 'Nothing Entered...' 0034 go SRCH 0035 end 0036 if upcase(SRCH) = 'E' or upcase(SRCH) = 'Q' then go OUTT 0037 print SPOT:' Enter FILE to Search for ':SRCH:' : ':CLSLN: 0038 input FL 0039 if upcase(FL) = 'E' or upcase(FL) = 'Q' then go OUTT 0040 if FL = EMP or FL = 0 then 0041 print 'No File Entered...' 0042 go SRCH 0043 end 0044 end 0045 open EMP,'FNDLST' TO FNDLST else 0046 gosub CLEANIT 0047 stopm 'No FNDLST File' 0048 end 0049 open EMP,FL to SRCHFL else 0050 gosub CLEANIT 0051 stopm 'No ':FL:' File' 0052 end 0053 read LOCKED from FNDLST,'LOCKED' then 0054 print 'Process being run by ':LOCKED<1> 0055 print 'If you continue, you will clear FNDLST from them' 0056 print 'Continue <ENTER>=No/Yes : ': 0057 input CONTI ; CONTI = upcase(CONTI) 0058 if CONTI = EMP or CONTI = 'N' then go OUTT 0059 end 0060 execute 'CLEAR.FILE FNDLST' CAPTURING OUTPUTLN 0061 writev @logname on FNDLST,'LOCKED',1 0062 select SRCHFL 0063 if FL[1,2] = 'BP' or FL[1,4] = 'PROG' or FL[1,3] = 'VOC' then 0064 DCT = 0 0065 end else 0066 DCT = 1 0067 end 0068 if DCT then 0069 open 'DICT',FL to DFL else 0070 gosub CLEANIT 0071 stopm 'No DICT ':FL:' File!!!! GET HELP!' 0072 end 0073 end 0074 PCNT = 1 0075 ST: readnext KEY else go OUTT 0076 inputif DOODLY,1: then go OUTT 0077 read REC from SRCHFL,KEY else 0078 print 'UNABLE TO OPEN "':KEY:'"' 0079 go ST 0080 end 0081 C = 1 0082 print SPOT:'Itm#: ':PCNT:' ':KEY:CLSLN: 0083 print SPTT:'Finding: ':SRCH:' in ':FL:CLSLN: 0084 PCNT += 1 0085 NXT: inputif DOODLY,1: then go OUTT 0086 findstr SRCH in REC setting POS else go ST 0087 ! if @logname = 'karl' then debug 0088 C += 1 0089 POS = POS'r%2' 0090 if POS then 0091 if Y > (BTM - 6) then Y = 2 0092 CNT += 1 0093 if DCT then 0094 readv DCTLN from DFL,'F':POS,4 else DCTLN = EMP 0095 print @(0,Y):CNT"R#4":' ':KEY:' on Line ':POS:' (':DCTLN:')':CLSLN:@(0,Y+1):CLSLN: 0096 end else 0097 print @(0,Y):CNT"R#4":' ':KEY:' on Line ':POS:CLSLN:@(0,Y+1):CLSLN: 0098 end 0099 write POS ON FNDLST,KEY 0100 Y += 1 0101 go ST 0102 end 0103 go NXT 0104 OUTT: print SPOT:CLSLN:SPTT:CLSLN: 0105 print SPTT:BCKSPC: 0106 delete FNDLST,'LOCKED' 0107 if CNT then 0108 print SPOT:PCNT:" Searched. To Edit/Save-List Found Files, Execute:":CLSLN 0109 print "SELECT FNDLST" 0110 print "ED FL/SAVE-LIST SLNAME" 0111 end else 0112 print SPOT:"Searched ":PCNT:" items in ":FL:". String ":SRCH:". Nothing Found...":CLSLN 0113 end 0114 CLEANIT: 0115 delete AR.CTL,"FINDALL" 0116 return 0117 end ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/