LinuxQuestions.org
Register a domain and help support LQ
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 08-21-2013, 06:44 AM   #1
manalisharmabe
Member
 
Registered: Dec 2010
Posts: 240

Rep: Reputation: 1
Need grep package with -A option for Solaris 10


Need grep package with -A option for Solaris 10

--------------------------------------------------------------------------------

Hi Guys,

I need grep package with -A option for Solaris 10,
Where can I download this from,

Please advise.
 
Old 08-21-2013, 06:51 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
GNU Grep for Solaris is available here: Sunfreeware
 
Old 08-21-2013, 06:56 AM   #3
manalisharmabe
Member
 
Registered: Dec 2010
Posts: 240

Original Poster
Rep: Reputation: 1
yes,i have downloaded from it. but it has no A option.
please suggest.
 
Old 08-21-2013, 07:03 AM   #4
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian Jessie / sid
Posts: 1,471

Rep: Reputation: 444Reputation: 444Reputation: 444Reputation: 444Reputation: 444
try full path

/usr/gnu/bin/grep
 
Old 08-21-2013, 07:03 AM   #5
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
Are you using the full path to gnu grep? Its been a while, but I do believe gnu grep is installed in /usr/local/bin.
 
Old 08-21-2013, 07:13 AM   #6
manalisharmabe
Member
 
Registered: Dec 2010
Posts: 240

Original Poster
Rep: Reputation: 1
look i wan to try this
http://stackoverflow.com/questions/1...-matching-line

I should be abale to print line above and below of searched word say "failed"

now tell me how to do the same thing in Solaris 10

Code:
[raju@100 ~]$ grep -A 1 -B 1 oprofile  /etc/passwd
sabayon:x:86:86:Sabayon user:/home/sabayon:/sbin/nologin
oprofile:x:16:16:Special user account to be used by OProfile:/home/oprofile:/sbin/nologin
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
[raju@100 ~]$
above is what we do in linux, so how to do this in Solaris

Last edited by manalisharmabe; 08-21-2013 at 07:19 AM.
 
Old 08-21-2013, 07:17 AM   #7
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
Quote:
Originally Posted by manalisharmabe View Post
look i wan to try this
http://stackoverflow.com/questions/1...-matching-line

I should be abale to print line above and below of searched word say "failed"
We know what the -A and -B switch do.

Please answer the question asked by Firerat and me.

It would also be nice if you posted the command you are trying to use.

Quote:
now tell me how to do the same thing in Solaris 10
Play nice! We are trying to help but we cannot if you don't answer our questions!
 
1 members found this post helpful.
Old 08-21-2013, 07:20 AM   #8
manalisharmabe
Member
 
Registered: Dec 2010
Posts: 240

Original Poster
Rep: Reputation: 1
I dont mean rude . please!
 
Old 08-21-2013, 07:21 AM   #9
manalisharmabe
Member
 
Registered: Dec 2010
Posts: 240

Original Poster
Rep: Reputation: 1
I want to do the same thing as posted above to search some logfile and their above below lines around particular search word in Solaris 10
 
Old 08-21-2013, 07:22 AM   #10
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian Jessie / sid
Posts: 1,471

Rep: Reputation: 444Reputation: 444Reputation: 444Reputation: 444Reputation: 444
see posts #4 and #5
I've never used solaris , so I don't know which is 'true'
only going off what I have seen posted here on LQ in the past
 
Old 08-21-2013, 07:23 AM   #11
manalisharmabe
Member
 
Registered: Dec 2010
Posts: 240

Original Poster
Rep: Reputation: 1
Code:
-bash-3.2$ which grep
/usr/bin/grep
-bash-3.2$ cd /usr/local/bin
-bash-3.2$ ls grep
grep
-bash-3.2$
-
I have this grep located at system.
 
Old 08-21-2013, 07:25 AM   #12
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
To make sure you are using the GNU version:
Code:
/usr/local/bin/grep --version
GNU grep <version number>

...
...
If the above is the case you can use:
Code:
/usr/local/bin/grep -A .......
 
Old 08-21-2013, 07:27 AM   #13
manalisharmabe
Member
 
Registered: Dec 2010
Posts: 240

Original Poster
Rep: Reputation: 1
Code:
-bash-3.2$ /usr/local/bin/grep --version
/usr/local/bin/grep (GNU grep) 2.14
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Haertel and others, see <http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.
-bash-3.2$
this what i have
 
Old 08-21-2013, 07:33 AM   #14
manalisharmabe
Member
 
Registered: Dec 2010
Posts: 240

Original Poster
Rep: Reputation: 1
Code:
-bash-3.2$ /usr/local/bin/grep -A 1 -B 1 ongert  /etc/passwd
rfasdbal:x:4841:102:ASD baleni (Liberec Information System User):/users/cz/182/rfasdbal:/usr/bin/ksh
ongert:x:4842:102:Onger Tomas (Liberec Technical User):/users/cz/182/ongert:/usr/bin/ksh
krizovd:x:4843:102:Krizova Denisa (Liberec Production User):/users/cz/182/krizovd:/usr/bin/ksh
-bash-3.2$
Thanks a LOt guys! Love you!

I hope it is solved now.
 
Old 08-21-2013, 07:38 AM   #15
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
Glad to see you got this fixed.

You can use -C instead of both -A and -B:
Code:
/usr/local/bin/grep -C 1 ongert /etc/passwd
BTW: Can you put up the [SOLVED] tag (upper right corener or Thread Tools menu).
 
  


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
problem using recursive grep (-r option) acomber Linux - Newbie 11 08-09-2012 01:33 AM
[SOLVED] using grep with -r option bibiki Linux - Newbie 4 02-20-2011 11:39 AM
understand -w option with grep geeyathink Programming 5 02-21-2008 04:17 AM
Paragraph-option to grep TheSpork Linux - General 2 03-17-2006 01:45 AM
grep option needed ziox Linux - General 7 01-04-2005 11:02 PM


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