LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 06-05-2012, 09:30 AM   #1
johnsonkv91
Member
 
Registered: Jan 2012
Posts: 52

Rep: Reputation: Disabled
Unhappy search command


Hi

I want to search for a specific sentence that consisting in a file. how to show its location and how many times it repeated. how to find out by using command line. I have tried with grep and find command, but it only shows some words in that sentence. I wont get right answer from anywhere. This is that sentence "!40001 SQL_NO_CACHE */ * FROM `vist`;" please help me ....!

Thanks
Johnson

Last edited by johnsonkv91; 06-08-2012 at 01:41 AM.
 
Old 06-05-2012, 09:59 AM   #2
imran042
Member
 
Registered: Feb 2012
Posts: 35

Rep: Reputation: Disabled
use regular expressions
 
Old 06-05-2012, 11:32 AM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by imran042 View Post
use regular expressions
That was not very helpful, was it.....

johnson;
If you need to match that exact sentence, then that is what you have to use in the search term. The problem is that something like grep will see the special characters as something in a Regex----eg "*" means any number of the preceding character. Thus you have to escape all such characters---eg instead of "*", use "\*"

If you can come up with a search term that is shorter, it will make your life easier. Post a copy of the file, and we might have some ideas.
 
  


Reply



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
Search for a linux command fjkum Linux - Newbie 4 01-07-2011 11:57 AM
search command? IonMarais Linux - Newbie 7 10-13-2006 06:59 AM
Search for threads about the dd command minrich LQ Suggestions & Feedback 3 08-14-2006 04:02 AM
command to search ekdya Linux - Newbie 3 11-12-2005 09:46 AM
search using description to get command? Linuxuser_81 Linux - Newbie 1 10-07-2005 12:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 02:57 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
Open Source Consulting | Domain Registration