How do I find a certain text in a document??
Moderators: JRL, Dorian (MJT support)
How do I find a certain text in a document??
All I want to do is search a known simple text document for 1 specific word of text and if it is in the document, play a wav file, if not close the program. I have to check my company bbs once per hour and search for this keyword. If it is there I want the computer to notify me. The keyword is "green", and the document is c:\new.txt. I know this is extremely basic, but I can't figure it out. Thanks
Label>FileCheck
IfFileExists>c:\new.txt,Grep
Wait>1
Goto>FileCheck
Label>Grep
Run Program>cmd /c find /c "green" c:\new.txt > c:\green.log
ReadLn>c:\green.log,2,line
Length>line,llenght
Sub>llenght,23
MidStr>%line%,24,%llenght%,result
If>result0,PlayThatFunkyMusicWildBoy
Goto>Cleaner
Label>PlayThatFunkyMusicWildBoy
PlayWav>%WIN_DIR%\media\chimes.wav
Label>Cleaner
Del>c:\new.txt
Del>c:\green.log
Goto>FileCheck
IfFileExists>c:\new.txt,Grep
Wait>1
Goto>FileCheck
Label>Grep
Run Program>cmd /c find /c "green" c:\new.txt > c:\green.log
ReadLn>c:\green.log,2,line
Length>line,llenght
Sub>llenght,23
MidStr>%line%,24,%llenght%,result
If>result0,PlayThatFunkyMusicWildBoy
Goto>Cleaner
Label>PlayThatFunkyMusicWildBoy
PlayWav>%WIN_DIR%\media\chimes.wav
Label>Cleaner
Del>c:\new.txt
Del>c:\green.log
Goto>FileCheck
- tony_smith
- Pro Scripter
- Posts: 70
- Joined: Wed May 14, 2003 8:25 pm
- Location: Vancouver BC Canada
Grep?
Grep? LAMUMBA... your Unix is showing
Well, regardless that I've to work with Billy Gates toy, it's never to late to work smart
--> even with Windows. Check this page: Cygwin or GNU
Download: GREP or the rest of the story like:
Textutils (which is included in the CoreUtils) contains the following software:
cat- concatenates and prints files on the standard output
cksum- checksum and count the bytes in a file
comm- compares two sorted files line by line
csplit- splits a file into sections determined by context lines
cut- remove sections from each line of files
expand- convert tabs to spaces
fmt- simple optimal text formatter
fold- wrap each input line to fit in specified width
head- output the first part of files
join- join lines of two files on a common field
md5sum- compute and check MD5 messsage digest
nl- number lines of files
od- dump files in octal and other formats
paste- merge lines of files
ptx- produce a permuted index of file contents
pr- convert text files for printing
sort- sort lines of text files
split- split a file into pieces
sum- checksum and count the blocks in a file
tac- concatenates and prints files in reverse
tail- outputs the last part of files
tr- translates or deletes characters
tsort- perform topological sort
unexpand- convert spaces to tabs
uniq- remove duplicate lines from a sorted file
wc- prints the number of bytes, words, and lines in files
Download
FYI: you should check the tools in detail eg. TAIL used with the parameter -f could be used as a realtime process log viewer
...

Download: GREP or the rest of the story like:
Textutils (which is included in the CoreUtils) contains the following software:
cat- concatenates and prints files on the standard output
cksum- checksum and count the bytes in a file
comm- compares two sorted files line by line
csplit- splits a file into sections determined by context lines
cut- remove sections from each line of files
expand- convert tabs to spaces
fmt- simple optimal text formatter
fold- wrap each input line to fit in specified width
head- output the first part of files
join- join lines of two files on a common field
md5sum- compute and check MD5 messsage digest
nl- number lines of files
od- dump files in octal and other formats
paste- merge lines of files
ptx- produce a permuted index of file contents
pr- convert text files for printing
sort- sort lines of text files
split- split a file into pieces
sum- checksum and count the blocks in a file
tac- concatenates and prints files in reverse
tail- outputs the last part of files
tr- translates or deletes characters
tsort- perform topological sort
unexpand- convert spaces to tabs
uniq- remove duplicate lines from a sorted file
wc- prints the number of bytes, words, and lines in files
Download
FYI: you should check the tools in detail eg. TAIL used with the parameter -f could be used as a realtime process log viewer
