LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 09-14-2017, 06:22 PM   #1
RandomTroll
Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 587

Rep: Reputation: 71
Creating a simple database with libdb


I want to take 2 lists of names (about 1M each), pick out the names in the second list that aren't in the first list. When
the lists were small, I read names in the second then did a
grep on each on the first. That now takes about 10 hours. A
database seems like a better choice. I found dbopen,
but it's out-of-date; its man page reads

Quote:
This page documents interfaces provided in glibc up
until version 2.1. Since version 2.2, glibc no longer
provides these interfaces. Probably, you are looking for the
APIs provided by the libdb library instead.
I have all the db packages installed but can't find man pages
for the API;
Code:
apropos db
doesn't return anything
relevant. The contents of the db packages don't have man pages.
The /usr/doc pages for the packages refer me to
Oracle's homes for the packages, which are voluminous and
opaque. Is there a simple tutorial for the person who doesn't
want to become an expert?
 
Old 09-14-2017, 08:40 PM   #2
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 675

Rep: Reputation: 255Reputation: 255Reputation: 255
I recommend using Sqlite. The command line shell is simple to use. https://sqlite.org/cli.html

You can create two tables and import your files. Not knowing how your files are laid out, you could do something like this:
Code:
sqlite> create table first_table(firstname, lastname);
sqlite> .separator " "   # not neccessary if delimiter is a comma
sqlite> .import firstfile first_table
sqlite> create table second_table(firstname, lastname);
sqlite> .separator " "   
sqlite> .import secondfile second_table
sqlite> .save combined.db
 
1 members found this post helpful.
Old 09-17-2017, 09:38 AM   #3
RandomTroll
Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 587

Original Poster
Rep: Reputation: 71
Thanks! That was the ticket. As soon as I figured out

Code:
select name from first_table where name not in second_table
it worked in seconds.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
creating database in mysql kc3377 Linux - Software 7 05-05-2008 10:18 AM
LXer: OOo Basic crash course: Creating a simple game using strings in a database LXer Syndicated Linux News 0 04-02-2008 05:50 PM
About creating database satimis Linux - Server 2 06-14-2007 01:12 PM
problems creating a simple bootable cd to perform a simple task czarherr Linux - Software 1 11-11-2004 05:22 AM
Creating an RPM database Null Linux - Software 6 03-20-2003 06:09 PM

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

All times are GMT -5. The time now is 02:33 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration