Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to grep into a manual of a particular command say man grep |grep 'insensitive'. One of friends told me that It can be done using xargs but I cant seem figure out how. I want to do it using xargs only because I am new to it and it is a very powerful tool.

Can anyone help me with this.

share|improve this question
3  
Do you just want to search a man page? Just type / and enter your search, just like in less or vim. –  tjameson Nov 27 '12 at 6:51
1  
I think you need to clarify what it is that you want to do. Both the command you wrote in the question, and tjameson's suggestion with /, will work to search inside a man page. But do you want to do something else? –  Thomas Padron-McCarthy Nov 27 '12 at 6:52
3  
What do you think xargs has to do with your task? –  dtmilano Nov 27 '12 at 6:59
    
xargs is just a way to pass data into command arguments (hence the name), so you don't need it for a simple grep. –  Phil H Nov 27 '12 at 8:29
add comment

migrated from stackoverflow.com Nov 27 '12 at 8:05

This question came from our site for professional and enthusiast programmers.

4 Answers

This will output the manual entry for grep to standard out by using cat as the pager:

man -P cat grep | grep -i insensitive

[BTW: The word "insensitive" does not appear in the manual for grep. Try ignore-case.]

share|improve this answer
add comment

You could always google like this:

site://http://linux.die.net/man/1/specificpage keyword
share|improve this answer
    
I want to do it using xargs, I know I am being unreasonable but I like using xargs because it seems like very interesting command –  Batman Nov 27 '12 at 6:56
5  
I want to boil some eggs, but I want to do it using the lawnmower. Right. echo grep | xargs man | grep 'insensitive' –  Thomas Padron-McCarthy Nov 27 '12 at 7:14
1  
@Thomas: Don’t be silly. The lawnmower is for scrambling eggs. –  Scott Nov 27 '12 at 23:49
add comment

Try this:

man grep | col -b | grep 'insensitive'

You may have to install col first. But you can "search" within less using / as was pointed out in the comments.

share|improve this answer
add comment
$ bzcat $(man -W bash  |tail -n1) |man2html | \
    html2text -style pretty -nobs | grep HISTORY
When the command history expansion facilities are being used (see HISTORY
      The name of the file in which command history is saved (see HISTORY
      The number of commands to remember in the command history (see HISTORY
      tokenization (see HISTORY EXPANSION below). The first character is the
commands restored from the history file (see HISTORY below), while the command
HISTORY below) for lines containing a specified string. There are two search
      expansion as well as all of the shell word expansions. See HISTORY
      Perform history expansion on the current line. See HISTORY EXPANSION
      HISTORY EXPANSION below for a description of history expansion.
HISTORY
HISTORY EXPANSION
                              HISTORY. This option is on by default in
  HISTORY
  HISTORY_EXPANSION
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.