[SOLVED] Need grep package with -A option for Solaris 10
Solaris / OpenSolarisThis forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
-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$
-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$
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.