Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

migrated from Nov 27 '12 at 8:05

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

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
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
What do you think xargs has to do with your task? – Diego Torres Milano 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

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

You could always google like this:

site:// 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
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
@Thomas: Don’t be silly. The lawnmower is for scrambling eggs. – Scott Nov 27 '12 at 23:49

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
$ 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. This option is on by default in
share|improve this answer

You must log in to answer this question.