LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris and OpenSolaris.
General Sun, SunOS and Sparc related questions also go here.

Notices

Reply
 
Search this Thread
Old 05-29-2007, 09:12 AM   #1
xpucto
Member
 
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 522

Rep: Reputation: 31
recursive grep


Hi!

I use solaris 10 and I wanted to use the following command
Quote:
grep -ri 'something' /somewhere
like I use under linux in order to find out which files include de the expression "something". but the option -r for grep is not accepted under solaris 10. which command could I use instead?

thanks.
 
Old 05-29-2007, 09:28 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Hi,

You could combine find and grep (possibly also using xargs).

find . -type f -exec grep "something" {} \;

or:

find . -type f | xargs grep 'something'

Hope this helps.
 
Old 05-29-2007, 09:57 AM   #3
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,500

Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
Quote:
Originally Posted by xpucto
I use solaris 10 and I wanted to use the following command
like I use under linux in order to find out which files include de the expression "something". but the option -r for grep is not accepted under solaris 10.
The "-r" is a non standard extension of Gnu grep.
Quote:
which command could I use instead?
Druuna suggestion will work and is portable. Alternatively, you can still run the same command you are used to. Just pick the gnu grep version which is bundled with Solaris:
/usr/sfw/bin/ggrep
 
  


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 output on stdout and grep output to file don't match xnomad Linux - General 3 01-13-2007 04:56 AM
bash script with grep and sed: sed getting filenames from grep odysseus.lost Programming 1 07-17-2006 11:36 AM
grep ?? can grep us variables? DaFrEQ Linux - Software 4 09-14-2005 12:22 PM
Recursive grep jimieee Linux - General 5 10-06-2003 10:13 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 03:56 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration