Grep And Offline Cartoon Voice-Finding
If you want to use the cartoon voices database on your own harddrive, simply save it with
your web-browser. If you want, change the filename to just "voices" instead
of "voices.htm". (Personally, I called the file voices before I put it
on the web and had to add the .htm extension)
Then, go to the directory where you saved it.
Once you are at the DOS command line, you have all the power:
Say you want all the Gargoyles voices. All you have to do is type:
grep gargoyles voices.htm...and you will get a line-by-line output of all the Gargoyles voices.
Say you want all the Frank Welker voices. All you have to do is type:
grep frank\ welker voices.htm...and you will get a line-by-line output of all of Frank Welker's voice credits. If you are wondering what the backslash does, the answer is this: The backslash makes the computer LOOK for a SPACE. Otherwise grep would be looking for "frank" in a file called "welker", and we wouldn't want that.
A regular expression is a way of specifying a very general string. The following regular expression symbols are treated specially: ^ start of line $ end of line . any character \ quote next character * match zero or more + match one or more [aeiou0-9] match a, e, i, o, u, and 0 thru 9 [^aeiou0-9] match anything but a, e, i, o, u, and 0 thru 9Say you wanted to search for all John Smiths. Then you'd need to type:
grep john\ smith voices.htmSay you wanted to find the cartoon voices for "The Big Dog" and "The Little Dog". Then you'd need to type:
grep the\ .*\ dog voices.htmOf course, this would also match up with any line that had "The" in it followed by "dog", such as this line:
grep the\ [bl].*\ dog voices.htmThis will narrow things down even more. Thus the power of grep.
So what about grepping for these special characters themselves?
Maybe you want to look for any $ signs--
But $ is a special character used for regular expressions. So if you
wanted to look for a $, you'd have to actually type \$ instead. If
you wanted to look for \, you'd have to actually type \\ instead.
(The backslach is an industry standard for special characters both
in regular expressions and in C programming, as well as many UNIX
Piping To Grep
You can pipe the output of a program to grep the same way you can
with any program. Say you are looking for a file with the word
"the" in the filename, but you don't know if it's at the beginning
(the*.*), at the end (*the.*), or maybe it's even the extension (*.the).
So what do you do? Try the directory command with all of these different
options? I would say just grep for "the"
in your directory! But how do you do this? Simple:
dir | grep theI even have an alias called "dg" (directory grep) so I can just type:
----TOP OF FILE---- @echo off dir | grep %1 %2 %3 %4 %5 %6 %7 %8 %9 ----END OF FILE----
Now instead of saying "dir *.com" you can say "dg com".
This may not seem useful, but if you have filename descriptions you can
grep for those. You can also grep for dates, like "dg -96",
which would look for all files from the year 1996. Nifty, huh?