LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training 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 06-06-2011, 03:33 PM   #1
linutzy
LQ Newbie
 
Registered: Jul 2005
Posts: 18

Rep: Reputation: 0
Request for grep -F example


Giving Linux a serious look again and starting from the beginning.

I read the man pages for grep -F but can't put my head around it.
I know it is like fgrep, but I was wondering if there is a real world use for it when searching through a file.

I did the standard grep -F in google but I'm not really able to find any details other then the:

-F, --fixed-strings
Interpret PATTERN as a list of fixed strings, separated by new-
lines, any of which is to be matched.

I just don't know how you would use it, kinda stumped, but very curious. It is however cryptic for me :-(
 
Old 06-06-2011, 04:19 PM   #2
hotspur919
LQ Newbie
 
Registered: Jan 2011
Location: Glasgow, UK
Distribution: RHEL, mint
Posts: 25

Rep: Reputation: 0
Heres something for you.


See explanation below. Hope it helps. i suppose it would be useful to find certain lines of code in a file perhaps.

1. fgrep '***' *



2 fgrep '[ ] * ? $' filex



EXPLANATION

1.

Displays any line containing three asterisks from each file in the present directory. All characters are treated as themselves (i.e., metacharacters are not special).
2.

Displays any lines in filex containing the string enclosed in quotes.


Definition: metacharacter: A character that is used to carry a special meaning, such as a caret (^, beginning of line), a dollar sign ($, end of line), or an asterisk (*, match any character). To use one of these characters without special meaning, you must either precede it with a backslash () or enclose it within quotation marks. Bypassing the special meaning of a metacharacter is called escaping or quoting the character.= fgrep bypasses the special meaning of these characters:-)

Last edited by hotspur919; 06-06-2011 at 04:32 PM.
 
  


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 03:09 PM
Bad Request Your browser sent a request that this server could not understand. vishnukumar Linux - Server 2 08-13-2009 01:56 AM
webserver doesn't reply to external request but it reply's to local request ziba Linux - Server 4 05-11-2009 06:27 PM
Trying to understand pipes - Can't pipe output from tail -f to grep then grep again lostjohnny Linux - Newbie 15 03-12-2009 11:31 PM
ps -ef|grep -v root|grep apache<<result maelstrombob Linux - Newbie 1 09-24-2003 12:38 PM


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