Do you remember program, which made database of all strings inside file hierarchy, so one could search strings?
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Do you remember program, which made database of all strings inside file hierarchy, so one could search strings?
I remember having such program in my Linux computer in the 90's.
So it probably run something like
Code:
find . -type f -exec strings '{}' ';' | put_these_in_db_with_filename
..and then there was a client program which was able quickly to find filename and location of some searched string using that db.
I tried to find it with Google, but no luck yet.
I remember having done, THATPROGRAM /
..and often found what I was looking for later. Maybe it even had incremental update algorithm so it was quicker next time an update was run.
Anyone remembers the name or finds it from the net?
There are a number of these. Macs have the feature built-in, which they call "Spotlight." (But I turned it off some time ago because it's quite a disk-I/O eater.)
As MichaelK corrected himself, "locate" is not the same thing. It quickly finds files but does not examine their content.
Last edited by sundialsvcs; 10-04-2022 at 01:42 PM.
#!/usr/bin/python
def search_str(file_path, word):
with open(file_path, 'r') as f:
content = f.read()
if word in content:
print(word, 'exist in file')
else:
print(word, 'does not exist in file')
st = input('Enter string to search for: ')
search_str(r'myfile.txt', st)
Code:
python ./sstring.py
Enter string to search for: dog
dog exist in file
python ./sstring.py
Enter string to search for: bird
bird does not exist in file
I guess you can't store all the strings of all files in a database, that will need a really huge amount of space. And it is usually not required (and cannot be maintained easily).
I think you are looking for locate/updatedb as it was already mentioned in post #3. But you may try to explain [better] what are you looking for.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.