LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-04-2011, 11:31 PM   #1
sunilsagar
Member
 
Registered: Jul 2011
Posts: 30

Rep: Reputation: Disabled
show only one output


I doing grep to find the path for software installation location. there are multiple output. I want to display only one output (the first output) that is /opt/pwp/3.0/bin.

Any suggestion. Thanks
Sunil

[root@hlixgr217 bin]# rpm -qal |grep pwp |grep bin
/opt/pwp/3.0/bin
/opt/pwp/3.0/bin/backup_config
/opt/pwp/3.0/bin/create_pwp_key
/opt/pwp/3.0/bin/pwpl
/opt/pwp/3.0/bin/pwpl_bin
/opt/pwp/3.0/bin/pwpl_null_bin
/opt/pwp/3.0/bin/pwppw
/opt/pwp/3.0/bin/pwppw_bin
/opt/pwp/3.0/bin/remoteadmin
/opt/pwp/3.0/bin/remoteadmin/add_client_hash
/opt/pwp/3.0/bin/remoteadmin/create_certificate
/opt/pwp/3.0/bin/remoteadmin/eers_data
 
Old 09-05-2011, 12:41 AM   #2
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Taken from man grep
Code:
-m NUM, --max-count=NUM
	      Stop reading a file after NUM matching lines.  If the  input  is
	      standard	input  from a regular file, and NUM matching lines are
	      output, grep ensures that the standard input  is	positioned  to
	      just  after the last matching line before exiting, regardless of
	      the presence of trailing context lines.  This enables a  calling
	      process  to resume a search.  When grep stops after NUM matching
	      lines, it outputs any trailing context lines.  When  the	-c  or
	      --count  option  is  also	 used,	grep  does  not output a count
	      greater than NUM.	 When the -v or --invert-match option is  also
	      used, grep stops after outputting NUM non-matching lines.
 
1 members found this post helpful.
Old 09-08-2011, 02:10 AM   #3
sunilsagar
Member
 
Registered: Jul 2011
Posts: 30

Original Poster
Rep: Reputation: Disabled
Thanks so much . It worked !
 
  


Reply



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
[SOLVED] not show output of simple module supernaturalyasir Linux - Newbie 1 07-03-2009 08:53 AM
My fstab output doesn't show my slave!!!!! faby1321 Linux - Newbie 3 01-06-2008 12:16 PM
Is there a way to show the output of background process? nadavvin Linux - General 1 05-27-2007 11:21 PM
Can I show different output on the laptop screen and the external one? riwaJR Linux - Laptop and Netbook 9 11-14-2006 02:01 PM
how to show input and output of a program on the terminal divin Linux - Software 1 03-25-2005 12:19 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:13 AM.

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
Open Source Consulting | Domain Registration