Yes it did, it just didnt end your problems.
The bigest problem is i think you need to make it clear what you want as a final result.
(1) Are you ONLY trying to detect one of a set number of words being present in line 2 of TEXT.TXT, or the whole file?
(2) And is it ONLY the exact word? ie: is if TEXT.TXT has APPLETREE in it and the word your looking for is LET then it is NOT found.
Here my question:
I have a textfile called test.txt. I want to read the 2nd line of it (or the hole text) and let my script search for a word in it, and compare this word with a word given. I have 26 diffrent words that are given. And when the script has found one of these words (there is all the time only one of these words in that .txt file), it will give out the result. Here is what I got but it never worked
(1) LINE2 (2) EXACT
[code]
alias textsearch {
var %test = $read(test.txt,nt,2)
if ($istok(%test,testword1,32)) { echo I have found the testword1 in test.txt line 2 }
if ($istok(%test,testword2,32)) { echo I have found the testword2 in test.txt line 2 }
...
}
[code]
(1) LINE2 (2) ANY
[code]
alias textsearch {
var %test = $read(test.txt,nt,2)
if (testword1 isin %text) { echo I have found the testword1 in test.txt line 2 }
if (testword2 isin %text) { echo I have found the testword2 in test.txt line 2 }
...
}
[code]
(1) ALLFILE (2) EXACT
[code]
alias textsearch {
if ( ($read(test.txt,ntw,* testword1 *)) || ($read(test.txt,ntw,testword1 *)) || ($read(test.txt,ntw,* testword1)) || ($read(test.txt,ntw,testword1)) ) { echo I have found the testword1 in test.txt }
if ( ($read(test.txt,ntw,* testword2 *)) || ($read(test.txt,ntw,testword2 *)) || ($read(test.txt,ntw,* testword2)) || ($read(test.txt,ntw,testword2)) ) { echo I have found the testword2 in test.txt }
...
}
[code]
(1) ALLFILE (2) ANY
[code]
alias textsearch {
if ( ($read(test.txt,ntw,*testword1*)) { echo I have found the testword1 in test.txt }
if ( ($read(test.txt,ntw,*testword2*)) { echo I have found the testword2 in test.txt }
...
}
[code]
.
.
.
.
.
ATTN: REGEX coderscan someone replace this please
if ( ($read(test.txt,ntw,* testword1 *)) || ($read(test.txt,ntw,testword1 *)) || ($read(test.txt,ntw,* testword1)) || ($read(test.txt,ntw,testword1)) ) { echo I have found the testword1 in test.txt }
Want to locate the word "textword1" which might be anyword inside TEXT.TXT but it must be a word, ie: NOT LET in APPLETREE
I think i found it using the word boundry control but im not confident on it.