LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-28-2014, 06:11 AM   #1
mehreen124
LQ Newbie
 
Registered: Feb 2014
Posts: 13

Rep: Reputation: Disabled
Query based Search Engine..Help required.


Its very urgent and I have no idea how to even get started with it. If anyone can only explain it to me how to start and explain what am I supposed to do in this question.
Design a Query based Search Engine which can categorize email addresses
on basis of Domain name. Make a supposition that recognized domains
are (@gmail.com, @hotmail.com, @yahoo.com, @nu.edu.pk). Text files based report must
be generated reflecting:
You must use Functions for each requirement mentioned below. In total there should be atleast 4 functions.
 Percentage of Email Occurrences of unique domain. ( A duplicate email entry must be
counted once)
 Create a filter to remove duplicate entries from data set and store the result in a file
named “filtered_data.txt”.
 Separate files for each unique domain name consisting of emails belong to it.
 Set the permissions of files that only owner can read and write, also make these files hidden through script.
 
Old 02-28-2014, 07:36 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,166

Rep: Reputation: 751Reputation: 751Reputation: 751Reputation: 751Reputation: 751Reputation: 751Reputation: 751
-Homework Assignment Alert-

Why not ask your tutor for clarification on the requirements?

Other than that, yes, it all looks like it can be done, however as you don't tell us what you can / can't use, what platform it is, whether you have access to a database or are having to do this all with "flat" files and BASH shell scripts we can't really help.

As with your other thread, post what you've done and we might be able to point you in the right direction.

Oh, and "It's very urgent", it may be for you, but as we all offer our time and experience for free it's not particularly urgent for us.
 
Old 02-28-2014, 07:52 AM   #3
mehreen124
LQ Newbie
 
Registered: Feb 2014
Posts: 13

Original Poster
Rep: Reputation: Disabled
Using flat files and shell scripting. I just need some direction as to how am i supposed to do this task
Thankyou in advance for any any help offered.
 
Old 02-28-2014, 08:02 AM   #4
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,166

Rep: Reputation: 751Reputation: 751Reputation: 751Reputation: 751Reputation: 751Reputation: 751Reputation: 751
Query based Search Engine..Help required.

Thing - Command
Searching - grep
Sorting - sort
Counting - wc -l
Splitting line into fields - awk or cut if they are fixed width
Filtering - uniq
Piping output through different commands - |

A lot depends on the source data file format, the above commands should give you a start.
 
1 members found this post helpful.
Old 02-28-2014, 08:18 AM   #5
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 3,827

Rep: Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356
Quote:
Originally Posted by TenTenths View Post
Thing - Command
Searching - grep
Sorting - sort
Counting - wc -l
Splitting line into fields - awk or cut if they are fixed width
Filtering - uniq
Piping output through different commands - |

A lot depends on the source data file format, the above commands should give you a start.
Looks to me like they are looking for a pure bash script that does this via functions.
 
Old 02-28-2014, 08:35 AM   #6
Habitual
LQ Addict
 
Registered: Jan 2011
Location: Youngstown, Ohio
Distribution: LM17.1/Xfce4.11.8
Posts: 7,186
Blog Entries: 10

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
Here's something that can perhaps be modified,

Good luck.
 
Old 02-28-2014, 09:19 AM   #7
mehreen124
LQ Newbie
 
Registered: Feb 2014
Posts: 13

Original Poster
Rep: Reputation: Disabled
if I have a file which is full of email id's of various domains and I want to use that file to calculate the percentage of Email Occurrences then how am I supposed to link that file to the function where I actually calculate the percentage of unique occurrence? how can I make checks on the data in that .txt file?
 
Old 02-28-2014, 09:27 AM   #8
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 3,827

Rep: Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356
Have you been paying attention in class? Doing the labs and such?

Have you even tried googling for this information?

We are not here to do your homework step by step for you. If you have a problem, either research it yourself, or post the code you have tried writing that is giving you the problem.
 
Old 02-28-2014, 09:34 AM   #9
mehreen124
LQ Newbie
 
Registered: Feb 2014
Posts: 13

Original Poster
Rep: Reputation: Disabled
I have never been using any such forums before and doing all my work by myself. I never asked for the solution to my question, only asked for a little guidance. We were not taught such things, thats y I had to ask and learn myself.
Anyways thankyou for all the help.
 
Old 02-28-2014, 09:47 AM   #10
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 3,827

Rep: Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356
Thats righteous that you are doing the work by yourself to learn something. Everyone will agree.

But, you aren't trying the researching bit very hard, evidenced by this: I went to google and typed in part of your question, and the second result is an entire conversation about this exact thing. It took me less than 3 seconds.

http://lmgtfy.com/?q=calculate+the+p...nces+in+a+file

Again, if you need help with part of your code, post it and ask a question. Because it's easier to understand your question when you post the code related to the question.
 
1 members found this post helpful.
Old 02-28-2014, 10:03 AM   #11
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,166

Rep: Reputation: 751Reputation: 751Reputation: 751Reputation: 751Reputation: 751Reputation: 751Reputation: 751
Let's have a little play......

data.txt
Code:
abc@example.com,Mr,Alf,Bravo,"Ordered Cake"
abc@example2.com,Mrs,Anne,Bravo,"Ordered Coffee"
abc@example.com,Mr,Alf,Bravo,"Ordered Coffee"
aaa@example.com,Mrs,Aurora,Ardvark,"Ordered Coffee"
abc@example.com,Mr,Alf,Bravo,"Ordered Cake"
Count the number of unique e-mail addresses in the file
Code:
awk -F, {'print $1'} data.txt | sort | uniq | wc -l
Returns 3, as expected.

Removed complete duplicates from the file
Code:
sort dats.txt | uniq
Result:
Code:
aaa@example.com,Mrs,Aurora,Ardvark,"Ordered Coffee"
abc@example2.com,Mrs,Anne,Bravo,"Ordered Coffee"
abc@example.com,Mr,Alf,Bravo,"Ordered Cake"
abc@example.com,Mr,Alf,Bravo,"Ordered Coffee"
So, as you can see with the commands I gave you to look at you can process a data file in a number of ways.

Good luck and come back with what you're trying.
 
Old 03-02-2014, 12:48 AM   #12
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
If this is part of a class (which it sounds like), then your class notes/book should give you all the pieces you need. If they are not clear ask your instructor.

As above, show us your code; we are here to help, but not to give the soln.

You should read this http://rute.2038bug.com/index.html.gz and see also http://www.grymoire.com/Unix/Awk.html, http://www.grymoire.com/Unix/Sed.html.
 
Old 03-02-2014, 02:26 AM   #13
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,255

Rep: Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686Reputation: 2686
I am with chrism01, you say you are doing a course but it is expecting you to learn the course material on your own???

Either you have not been paying attention or you have been ripped off
 
  


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
[SOLVED] Which search engine does LinuxQuestions use when you use 'Search'? Robert.Thompson LQ Suggestions & Feedback 7 12-15-2010 05:49 PM
LXer: Wiki-based search engine launched LXer Syndicated Linux News 0 01-09-2008 01:50 PM
Search engine Hammett LQ Suggestions & Feedback 5 01-10-2007 04:03 PM
Search Engine? phek Linux - General 1 09-20-2001 08:00 PM


All times are GMT -5. The time now is 08:31 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