[SOLVED] Need grep package with -A option for Solaris 10
Solaris / OpenSolarisThis forum is for the discussion of Solaris and OpenSolaris.
General Sun, SunOS and Sparc related questions also go here.
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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
[raju@100 ~]$ grep -A 1 -B 1 oprofile /etc/passwd
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
above is what we do in linux, so how to do this in Solaris
Last edited by manalisharmabe; 08-21-2013 at 08: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$ /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