Sunday, September 26, 2004

 

How to find keyword combinations

This batch file (combin.bat) is was written on a Windows XP system, and might need modification for older or newer systems. It takes one parameter--the number of keywords (or groups of keywords). The output is a 2nd batch file which will be used to write the output to a file titled 'List'.
Combin.bat:
@echo off
Rem Find out if we're dealing with sets of keywords
echo \%1>combin.tmp
find /i "set" combin.tmp>nul
if not errorlevel==1 %*
Rem In XP %* refers to all parameters given a batch file
if %1.==%0. goto printit
Rem If the 1st parameter is the same as the batch file, we're printing the results
Rem If we give no parameter or we don't give a valid number, select 8 'keywords'
if %1.==. %0 8
if %2.==. echo \1\2\3\4\5\6\7\8\>combin.tmp
find "%1" combin.tmp>nul
if %2.==. if errorlevel==1 %0 8
if %2.==. echo \ >combin.tmp
find "%1" combin.tmp>nul
if %2.==. if not errorlevel==1 %0 8
Rem Ensure that we don't duplicate groups of keywords
if %1==7 if not %2.==. echo %2 >combin.tmp
find "!!!!!!!!" combin.tmp>nul
if %1==7 if not %2.==. if not errorlevel==1 goto end
if %1==6 if not %2.==. echo %2 >combin.tmp
find "!!!!!!!" combin.tmp >nul
if %1==6 if not %2.==. if not errorlevel==1 goto end
if %1==5 if not %2.==. echo %2 >combin.tmp
find "!!!!!!" combin.tmp >nul
if %1==5 if not %2.==. if not errorlevel==1 goto end
if %1==4 if not %2.==. echo %2 >combin.tmp
find "!!!!!" combin.tmp >nul
if %1==4 if not %2.==. if not errorlevel==1 goto end
if %1==3 if not %2.==. echo %2 >combin.tmp
find "!!!!" combin.tmp>nul
if %1==3 if not %2.==. if not errorlevel==1 goto end
if %1==2 if not %2.==. echo %2 >combin.tmp
find "!!!" combin.tmp >nul
if %1==2 if not %2.==. if not errorlevel==1 goto end
if %1==1 if not %2.==. echo %2 >combin.tmp
find "!!" combin.tmp >nul
if %1==1 if not %2.==. if not errorlevel==1 goto end
if %2.==.. goto end
if %3.==.. goto end
if %4.==.. goto end
if %5.==.. goto end
if %6.==.. goto end
if %7.==.. goto end
if %8.==.. goto end
if %9.==.. goto end
if not %1.==. if %1.==%2. goto end
if not %1.==. if %1.==%3. goto end
if not %1.==. if %1.==%4. goto end
if not %1.==. if %1.==%5. goto end
if not %1.==. if %1.==%6. goto end
if not %1.==. if %1.==%7. goto end
if not %1.==. if %1.==%8. goto end
if not %1.==. if %1.==%9. goto end
if not %2.==. if %2.==%3. goto end
if not %2.==. if %2.==%4. goto end
if not %2.==. if %2.==%5. goto end
if not %2.==. if %2.==%6. goto end
if not %2.==. if %2.==%7. goto end
if not %2.==. if %2.==%8. goto end
if not %2.==. if %2.==%9. goto end
if not %3.==. if %3.==%4. goto end
if not %3.==. if %3.==%5. goto end
if not %3.==. if %3.==%6. goto end
if not %3.==. if %3.==%7. goto end
if not %3.==. if %3.==%8. goto end
if not %3.==. if %3.==%9. goto end
if not %4.==. if %4.==%5. goto end
if not %4.==. if %4.==%6. goto end
if not %4.==. if %4.==%7. goto end
if not %4.==. if %4.==%8. goto end
if not %4.==. if %4.==%9. goto end
if not %5.==. if %5.==%6. goto end
if not %5.==. if %5.==%7. goto end
if not %5.==. if %5.==%8. goto end
if not %5.==. if %5.==%9. goto end
if not %6.==. if %6.==%7. goto end
if not %6.==. if %6.==%8. goto end
if not %6.==. if %6.==%9. goto end
if not %7.==. if %7.==%8. goto end
if not %7.==. if %7.==%9. goto end
if not %8.==. if %8.==%9. goto end
if not %2.==. echo %2 >combin.tmp
find "%1" combin.tmp>nul
if not %2.==. if not errorlevel==1 goto end
if not %3.==. echo %3 >combin.tmp
find "%2" combin.tmp>nul
if not %3.==. if not errorlevel==1 goto end
if not %4.==. echo %4 >combin.tmp
find "%3" combin.tmp>nul
if not %4.==. if not errorlevel==1 goto end
if not %5.==. echo %5 >combin.tmp
find "%4" combin.tmp>nul
if not %5.==. if not errorlevel==1 goto end
if not %6.==. echo %6 >combin.tmp
find "%5" combin.tmp>nul
if not %6.==. if not errorlevel==1 goto end
if not %7.==. echo %7 >combin.tmp
find "%6" combin.tmp>nul
if not %7.==. if not errorlevel==1 goto end
if not %8.==. echo %8 >combin.tmp
find "%7" combin.tmp>nul
if not %8.==. if not errorlevel==1 goto end
if not %9.==. echo %9 >combin.tmp
find "%8" combin.tmp>nul
if not %9.==. if not errorlevel==1 goto end
Rem build list of keyword combinations
if not %2.==. echo call %0 %0 %%* %2 %3 %4 %5 %6 %7 %8 %9 >>list.bat
if %2.==. for %%o in (!!!!!!!! !!!!!!! !!!!!! !!!!! !!!! !!! !! !) do call %0 %1 %%o
if not %2.==. if %3.==. for %%o in (. !!!!!!! !!!!!! !!!!! !!!! !!! !! !) do call %0 %1 %2 %%o
if not %3.==. if %4.==. for %%o in (. . !!!!!! !!!!! !!!! !!! !! !) do call %0 %1 %2 %3 %%o
if not %4.==. if %5.==. for %%o in (. . . !!!!! !!!! !!! !! !) do call %0 %1 %2 %3 %4 %%o
if not %5.==. if %6.==. for %%o in (. . . . !!!! !!! !! !) do call %0 %1 %2 %3 %4 %5 %%o
if not %6.==. if %7.==. for %%o in (. . . . . !!! !! !) do call %0 %1 %2 %3 %4 %5 %6 %%o
if not %7.==. if %8.==. for %%o in (. . . . . . !! !) do call %0 %1 %2 %3 %4 %5 %6 %7 %%o
if not %8.==. if %9.==. for %%o in (. . . . . . . !) do call %0 %1 %2 %3 %4 %5 %6 %7 %8 %%o
goto end
:printit
shift
shift
echo \%0 >combin.tmp
find /i "\set" combin.tmp>nul
if not errorlevel==1 %*
echo %*
echo %*>>list
del combin.tmp
:end

Thursday, September 16, 2004

 

first post, just to hold my place!

Well, you've stumbled on my blog. Welcome!

My interests: the Middle East, Early (& non-European) Christianity, Jewish history, Hinduism, Islam, Philosophy, Science Fiction, Fantasy (Tolkein, etc.), Celtic stuff, Languages and linguistics...

Why the title--'Nukraya'? It means 'stranger' in Aramaic, and I am that. Kinda wierd, ya know? Also, I like 'Stranger in a Strange Land' by Robert Heinlein. 'StrangerInAStrangeLand' is kinda long and pretentious for a blog name, and worse in Aramaic [NukrayabAr'aNukraya] so I just stuck with 'Nukraya'. No, I'm not from the Middle East, and my ancestors were all from North-West Europe as far as I know.


Be Well,
Bob Griffin


This page is powered by Blogger. Isn't yours?