LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 01-30-2005, 02:21 PM   #1
genderbender
Member
 
Registered: Jan 2005
Location: US
Distribution: Centos, Ubuntu, Solaris, Redhat
Posts: 396

Rep: Reputation: 31
Multiple searches (sorry if this is a long thread)


This is part of my assignment and two of the assignment "problems" are I cant use switches and its gotta be bash (not a problem really). Its my first bash program so you'll have to go easy as this is probably quite a basic question.

Ive got two database files called vehicle and customer. Heres an example of one customer in the customer file, there are others in it obviously.

customer number 3
first name steve
surname johnson
post code wm83ee
telephone number 0800123456

my vehicle database look like this:

car reg no g428nug
colour green
model audi
year of manufacture 1991
selling price 200
sold flag Y
customer number 3

I've done nearly all the script apart from this section and i dont really know where to start besides grep, but i need multiple instances of grep to search and output lots of different things and then compare them with the other file. Heres the bit I'm stuck on:

"Perform an audit (i.e. consistency check) of the database. You will identify all customer records with no corresponding vehicle record and all vehicle records marked as sold with no corresponding customer record."

I think my good old cisco lecturer who hates programming would also be impressed with an output like echo "records are consistant" or records are crap, whatever. Only way i can think of doing this is a switch but its not allowed


Any help at all, even a clue as to how I'd do this would be perfect.


Thanks a LOT!
 
Old 01-30-2005, 04:41 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,535

Rep: Reputation: 148Reputation: 148
customers with no vehicle: make a big grep on customer number in vehicle database and compare with the same grep (sorted, probably) on customers. To compare them you can use diff (if you're allowed to use it).

sold vehicles with no customer: if the database looks always the same and customer number should be always after sold flag try to use and of line mark with grep regexp.
 
Old 01-30-2005, 06:03 PM   #3
genderbender
Member
 
Registered: Jan 2005
Location: US
Distribution: Centos, Ubuntu, Solaris, Redhat
Posts: 396

Original Poster
Rep: Reputation: 31
Thanks a lot mate, thats precisely what i was after. I accidently posted this twice and got in a lot of trouble (not only for posting twice but asking for help).

Thanks a lot, I'll do that tomorrow and thanks not for sending me to man bash etc....
 
  


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
Multiple Hardware issues (long post) Rahven Linux - Hardware 8 02-11-2007 05:20 AM
What one should do if there's no answers to his thread/post for a long time ? kuser:) LQ Suggestions & Feedback 10 09-27-2005 05:03 PM
Multiple searches? genderbender Programming 7 01-30-2005 04:20 PM
Searches Thulemanden LQ Suggestions & Feedback 1 12-05-2004 10:26 AM
Any good thread programming theory (for multiple cpus) book/tutorial karlan Programming 3 10-04-2004 11:48 PM


All times are GMT -5. The time now is 02:59 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration