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 12-14-2007, 01:57 PM   #1
manolakis
Member
 
Registered: Nov 2006
Distribution: xubuntu
Posts: 419

Rep: Reputation: 31
linux command


Hi there

Does anybody know any command that can search in all text files for a particular string. Imagine that you use a large Java package and you want to search for a particular class in the whole package. The command should be able to look into sub-folders as well. I will be really pleased if anyone could post an example.

Thanks
 
Old 12-14-2007, 02:07 PM   #2
kaz2100
Senior Member
 
Registered: Apr 2005
Location: Penguin land, with apple, no gates
Distribution: Debian testing woody(32) sarge etch lenny squeeze(+64) wheezy jessie stretch
Posts: 1,593

Rep: Reputation: 97
Hya,

I do not think it is difficult.
Code:
grep -r stringToFind where/to/find
Hope this helps.

Happy Penguins!
 
Old 12-14-2007, 03:28 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally Posted by manolakis View Post
Hi there

Does anybody know any command that can search in all text files for a particular string. Imagine that you use a large Java package and you want to search for a particular class in the whole package. The command should be able to look into sub-folders as well. I will be really pleased if anyone could post an example.

Thanks

If java package means a jar file, grep won't work like that.
You'll need to explode the package, and then grep through that,
as the content of jars is zipped.


Cheers,
Tink
 
Old 03-02-2008, 09:06 AM   #4
manolakis
Member
 
Registered: Nov 2006
Distribution: xubuntu
Posts: 419

Original Poster
Rep: Reputation: 31
Hi again

I would like to ask how can I use the grep command for a string which consists of space.

Any ideas will be welcomed.
Thanks
 
Old 03-02-2008, 09:08 AM   #5
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Put the string in double quotes.
 
  


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
Require Linux/Perl equivalent command for windows Command alix123 Programming 7 08-19-2005 03:23 AM
unix command to linux command leonidas Linux - General 1 09-10-2004 01:40 AM


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