LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 11-02-2009, 08:37 PM   #1
deandre_7
LQ Newbie
 
Registered: Nov 2009
Posts: 1

Rep: Reputation: 0
Unhappy Searching a file containing patterns and placing them in another file.


Hi, i'm faced with this question, can anyone help me?
Thanks

Search the file 'data' for all of the lines that contain the pattern 'uli101'and put those lines in the file 'matches'.
 
Old 11-02-2009, 08:55 PM   #2
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by deandre_7 View Post
Hi, i'm faced with this question, can anyone help me?
Thanks

Search the file 'data' for all of the lines that contain the pattern 'uli101'and put those lines in the file 'matches'.
First, tell us from what environment you want this result. Second, post your best effort, describe the remaining problems and ask for help.
 
Old 11-02-2009, 09:04 PM   #3
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,811
Blog Entries: 1

Rep: Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191
It looks like homework. What have you done so far to solve this problem?
 
Old 11-02-2009, 10:24 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
OK--I closed the other one instead.....

As already stated, if you want help with your homework, you need to show us what you have done. Also, tell us what books and reference material you are using

Last edited by pixellany; 11-02-2009 at 10:32 PM.
 
Old 03-09-2011, 11:15 AM   #5
gslinga
LQ Newbie
 
Registered: Mar 2011
Posts: 1

Rep: Reputation: 0
Need help asap dunt f** me

Need help with question stop b**

Last edited by Mara; 03-10-2011 at 05:33 PM. Reason: language
 
Old 06-30-2011, 10:40 AM   #6
karim89
LQ Newbie
 
Registered: Jun 2011
Posts: 1

Rep: Reputation: Disabled
Search the file 'data' for all of the lines that contain the pattern 'uli101'
and put those lines in the file 'matches'.

I have the same problem with the same question. Here is what I tried out:

tail data | head uli101 > matches

I have no clue how to do the question. I am using SSH
 
Old 06-30-2011, 11:00 AM   #7
Karl Godt
Member
 
Registered: Mar 2010
Location: Kiel , Germany
Distribution: once:SuSE6.2,Debian3.1, aurox9.2+3,Mandrake?,DSL? then:W7st,WVHB, #!8.10.02,PUPPY4.3.1 now:Macpup
Posts: 314

Rep: Reputation: 45
Pattern usually means inside a file .

There are some command --help that uses PATTERN for the filename .

In this case
Code:
grep -n -i -E 'uliXYZ|samanthaABC' /Path/To/File/Filename.txt
should do it .

head uliXYZ would return the first 10 lines of the file uliXYZ , not the content uliXYZ .

If you only want the first 10 lines use "grep -m 10" or "grep -A 10" .




Read "grep --help" and "man grep" .

You can also filter it through grep like
Code:
cat infile | grep 'uliXYZ'
 
  


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
Grep file using last specific file patterns jeesun Programming 19 11-24-2009 10:51 PM
merging several Postscript files in one file ( or even more placing in one page ) madani Linux - Newbie 3 08-25-2009 11:58 AM
searching for redundant patterns adidassharma Programming 5 09-26-2008 01:35 AM
awk searching a string from a file within another file changcheh Linux - Software 7 12-29-2006 10:18 AM
Searching patterns from file MichaelVaughn Programming 1 04-06-2004 12:18 PM


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