LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 09-26-2010, 10:08 AM   #1
flyingsuperhigh
LQ Newbie
 
Registered: Sep 2010
Posts: 1

Rep: Reputation: 0
using grep


Hello Everyone,

I have a pretty simple problem but I still can't seem to figure out the solution. I basically have to use the grep command (I can't use any other command) to find a match. There a two files that exist. One file called (sorted.txt) contains information about users (one user per line). This information consists of their id, username, email, ...The second file (invalid.txt) contains just the name of the user (username). My task is to compare these two files and display all the user's and their info (id, username, email,...) who are on the second file. Also, I am writing the output to another file called found.txt. It's a homework task but I don't have to hand it in. I have a test coming up on using unix commands and this is just an example to help me study.

This is the command I am using:

grep -o -F /home/2009/jack/comp206/store/testbed/invalid.txt /home/2009/jack/comp206/store/testbed/sorted.txt>/home/2009/jack/comp206/store/testbed/found.txt
 
Old 09-26-2010, 11:46 AM   #2
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
Quote:
This is the command I am using:

grep -o -F /home/2009/jack/comp206/store/testbed/invalid.txt /home/2009/jack/comp206/store/testbed/sorted.txt>/home/2009/jack/comp206/store/testbed/found.txt
And your question is ...? Have you tried out your command? Does it work? Are there problems?
jdk
 
Old 09-26-2010, 08:20 PM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,492

Rep: Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867
Maybe you could also tell us what you think each of your switches do? (hint)
 
  


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] Grep -p for Linux, Trying to grep a paragraph. ohijames Linux - Newbie 5 07-22-2010 02:09 PM
Trying to understand pipes - Can't pipe output from tail -f to grep then grep again lostjohnny Linux - Newbie 15 03-12-2009 10:31 PM
how to grep multiple filters with grep LinuxLover Linux - Enterprise 1 10-18-2007 07:12 AM
grep output on stdout and grep output to file don't match xnomad Linux - General 3 01-13-2007 04:56 AM
ps -ef|grep -v root|grep apache<<result maelstrombob Linux - Newbie 1 09-24-2003 11:38 AM


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

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