Can Everything search text inside text files?

General discussion related to "Everything".
Post Reply
Vortex
Posts: 11
Joined: Tue Aug 30, 2016 9:26 am

Can Everything search text inside text files?

Post by Vortex »

Can Everything search text inside text files?

I have a text file with 3,200 lines, each containing an authors name and associated book title. Example:

Code: Select all

George Orwell 1984
H. G. Wells War of the Worlds
Isaac Asimov I, Robot
I also have a folder containing a dozen text lists of ebook filenames (Some of the lists have over 500K lines.), for example:

Code: Select all

George Orwell - 1984 (epub).rar
H G Wells - War of the Worlds (pdf).rar
Isaac Asimov - [Robot 0.1] - I, Robot (Mobi).rar 
I need to search the text files of filenames for the 3,200 author and titles, and output the results to a 3rd text list.

The filenames also contain other stuff like series info, format, etc, so I'm looking for any lines that contain those authors names and titles.

Can anyone please help me out with the code. Thanks.
EDIT: Added more examples.
Last edited by Vortex on Sun Jun 17, 2018 10:33 pm, edited 2 times in total.
Stamimail
Posts: 1122
Joined: Sat Aug 31, 2013 9:05 pm

Re: Can Everything search text inside text files?

Post by Stamimail »

viewtopic.php?t=5546
viewtopic.php?t=6376

btw, try to add more lines in your example, to make it more clear.
void
Developer
Posts: 16773
Joined: Fri Oct 16, 2009 11:31 pm

Re: Can Everything search text inside text files?

Post by void »

Please try the content: search function, for example:

d:\ebooks\ *.txt content:"George Orwell 1984"
d:\ebooks\ *.txt content:"H. G. Wells War of the Worlds"
d:\ebooks\ *.txt content:"Isaac Asimov I, Robot"
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Can Everything search text inside text files?

Post by NotNull »

The content: function is not of much use in this case, as it will just report the (one of the dozen) filenames wherein this text was found (like index1.txt), not the actual filename (like George Orwell - 1984 (epub).rar).


Do you have those files (like George Orwell - 1984 (epub).rar) on your disk? then you can skip searching in the dozen index files.

The question itself is rather vague. What should be in the output file? What is this "code" you are referring to?
Please explain yourself further ..

Note that you probably will have some mismatches. That becomes apparent even in your own examples: H G Wells vs H.G. Wells (where HG Wells is yet another possibility(
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Can Everything search text inside text files?

Post by NotNull »

Regarding the "code": Do you mean some sort of script? I think that can be done quite easily (depending on what should be in the output file).
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Can Everything search text inside text files?

Post by NotNull »

I was cleaning out my harddisks and found a script lying around to do what (I think) you are looking for. Completely forgot about that one ..

Instructions:
- Save FindBook.cmd in an empty folder
- Save your "text file with 3,200 lines" as titlelist.txt in that folder
- Create a folder "filelist" in that folder.
- Copy the "dozen text lists of ebook filenames" to the filelist folder

Result should be something like:

Code: Select all

C:\test\boek\FindBook.cmd
C:\test\boek\titlelist.txt

C:\test\boek\filelist\index1.txt
C:\test\boek\filelist\index2.txt
- Run FindBook.cmd

Output:

Code: Select all

filelist\index1.txt:George Orwell - 1984 (epub).rar
filelist\index2.txt:George Orwell - 1984 (epub).rar
filelist\index1.txt:H G Wells - War of the Worlds (pdf).rar
filelist\index2.txt:Isaac Asimov - [Robot 0.1] - I, Robot (Mobi).rar

Press any key to continue . . .


This was tested with the following inputfiles:

Titlelist.txt:
George Orwell 1984
H. G. Wells War of the Worlds
Isaac Asimov I, Robot

Index1.txt
George Orwell - 1984 (epub).rar
H G Wells - War of the Worlds (pdf).rar
Some random filename.txt

Index2.txt
George Orwell - 1984 (epub).rar
Isaac Asimov - [Robot 0.1] - I, Robot (Mobi).rar
Some random filename.txt



Findbook.cmd

Code: Select all

@echo off
pushd "%~dp0"

for /f "delims=" %%x in (titlelist.txt) DO call :AXI "%%x"
echo.
pause
goto :EOF


:AXI
	set ff=%~1
	set regex=^%ff: =.*%.*
	findstr /i /R "^%regex%" filelist\*

goto :EOF

Post Reply