0

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.

4
  • 3
    Do you just want to search a man page? Just type / and enter your search, just like in less or vim.
    – beatgammit
    Nov 27, 2012 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? Nov 27, 2012 at 6:52
  • 3
    What do you think xargs has to do with your task? Nov 27, 2012 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, 2012 at 8:29

4 Answers 4

1

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.]

0

You could always google like this:

site://http://linux.die.net/man/1/specificpage keyword
3
  • 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, 2012 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' Nov 27, 2012 at 7:14
  • 1
    @Thomas: Don’t be silly. The lawnmower is for scrambling eggs. Nov 27, 2012 at 23:49
0

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.

0
$ 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

You must log in to answer this question.