LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 10-04-2022, 11:00 AM   #1
zimon
Member
 
Registered: Sep 2004
Posts: 42

Rep: Reputation: 16
Question 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?
 
Old 10-04-2022, 11:52 AM   #2
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,506

Rep: Reputation: Disabled
Maybe it was a program that used sqlite/sqlite3 as a backend(?).

https://www.sqlite.org/whentouse.html

https://www.sqlitetutorial.net/sqlite-nodejs/connect/
 
Old 10-04-2022, 11:55 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,764

Rep: Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931Reputation: 5931
mlocate? The update program is called updatedb and usually runs via a daily cron job.

The user program is called locate.

I misunderstood the question. locate is just used to find files.

I use grep but it does not use a database

Last edited by michaelk; 10-04-2022 at 12:17 PM.
 
Old 10-04-2022, 12:54 PM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,783

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
Are you thinking of Beagle?
 
Old 10-04-2022, 01:41 PM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,679
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
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.
 
Old 10-04-2022, 02:27 PM   #6
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,147
Blog Entries: 6

Rep: Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834
Quick simple example, trying to shove you in the right direction.

pydb.py
Code:
#!/usr/bin/python

import sqlite3

try:
    conn = sqlite3.connect("Sqlite3.db")
    print("Database Sqlite3.db formed.")
except:
    print("Database Sqlite3.db not formed.")
    
c = conn.cursor()
   
c.execute('''CREATE TABLE IF NOT EXISTS files ([files_id] INTEGER PRIMARY KEY, 
            [file_name] TEXT)''')
          
conn.commit()
          
c.execute('''INSERT INTO files (files_id,file_name) VALUES
            (1,'file1'),
            (2,'file2'),
            (3,'file3'),
            (4,'file4'),
            (5,'file5')
          ''')
          
conn.commit()
Edit:
Oh, and you can look at that with pandas. Or use sqlitebrowser.

Last edited by teckk; 10-04-2022 at 02:30 PM.
 
Old 10-04-2022, 02:51 PM   #7
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,147
Blog Entries: 6

Rep: Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834
One more push.

Code:
cat myfile.txt
cat dog cow chicken
sstring.py
Code:
#!/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
 
Old 10-05-2022, 12:28 AM   #8
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,989

Rep: Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337
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.
 
  


Reply

Tags
database, locate, old-school, search engine, strings



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I have mint18 cinnamon installed on my Toshiba Satellite C850 and can remember the password but can't remember the username. stringybark Linux - Laptop and Netbook 11 12-29-2017 07:20 PM
[Solved] search for exact strings from one file to another and write if not exist pedropt Programming 13 07-19-2017 01:30 PM
replace strings in a file using strings from another file xpto09 Linux - Newbie 3 01-28-2016 06:11 PM
BASH: replace strings in on file by the strings in another one cristalp Programming 5 10-28-2011 09:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration