Unix Shell - Searching in Manpage with Bash

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > May 2004 > Searching in Manpage with Bash





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Searching in Manpage with Bash
Edward Wijaya

2004-05-19, 5:40 pm

Hi,

Is there a way to search a text within
a Manpage with bash?

Man itself doesn't seem to have any
particular command right?

Regards
Edward WIJAYA
Kevin Rodgers

2004-05-19, 5:41 pm

Edward Wijaya wrote:
> Is there a way to search a text within a Manpage with bash?
>
> Man itself doesn't seem to have any particular command right?


`man man` tells you this:

ENVIRONMENT VARIABLES
....
PAGER A program to use for interactively delivering man
's output to the screen. If not set, `more -s' is
used. See more(1).

And `man more` tells you this:

Commands
....
In the following commands, i is a numerical argument (1 by
default).
....
in Search for the ith occurrence of the last pattern
entered.
....
i/pattern Search forward for the ith occurrence of the regu-
lar expression pattern. Display the screenful
starting two lines before the line that contains
the ith match for the regular expression pattern,
or the end of a pipe, whichever comes first. If
more is displaying a file and there is no match,
its position in the file remains unchanged. Regu-
lar expressions can be edited using erase and kill
characters. Erasing back past the first column
cancels the search command.

--
Kevin Rodgers

Alan Connor

2004-05-19, 5:41 pm

On Thu, 20 May 2004 00:41:11 -0000, Edward Wijaya <ewijaya@singnet.com.sg> wrote:
>
>
> Hi,
>
> Is there a way to search a text within
> a Manpage with bash?
>
> Man itself doesn't seem to have any
> particular command right?
>


Just hit "/" for forward searches and enter your search string. "?" for
backwards searches. "n" to repeat. Escape-u to clear the highlighted
strings from the screen. Up/Down arrows for search history.

This is when PAGER is set to less, which I highly recommend. It's the
best one and worth learning a bit about.

Man man; man less.

AC

Kevin Collins

2004-05-20, 5:37 pm

In article <opr79v6xbbuj0cst@news.singnet.com.sg>, Edward Wijaya wrote:
> Hi,
>
> Is there a way to search a text within
> a Manpage with bash?
>
> Man itself doesn't seem to have any
> particular command right?
>
> Regards
> Edward WIJAYA


Others have already mentioned the man page for 'man' and using the '/' and '?'
search keys. Another good tip to know is to use:

man xyz - | col -b > xyz.txt

This will give you a plain-text copy of the manpage for 'xyz' in a text file.
You can then do what you like to search it.

Kevin

ps - I have noticed a high volume of posts from you in both this group and
comp.lang.perl.misc that could be solved by actually SEARCHING for an answer
and/or reading the FAQs and/or reading man pages (and perldocs). Use of
google.com and groups.google.com is highly recommended. While most folks don't
mind answering questions, after a while we get tired of seeing the same
questions repeated over and over again.
Dan Mercer

2004-05-20, 5:37 pm


"Kevin Collins" <spamtotrash@toomuchfiction.com> wrote in message news:slrncapllk.hc2.spamtotrash@doom.unix-guy.com...
: In article <opr79v6xbbuj0cst@news.singnet.com.sg>, Edward Wijaya wrote:
: > Hi,
: >
: > Is there a way to search a text within
: > a Manpage with bash?
: >
: > Man itself doesn't seem to have any
: > particular command right?
: >
: > Regards
: > Edward WIJAYA
:
: Others have already mentioned the man page for 'man' and using the '/' and '?'
: search keys. Another good tip to know is to use:
:
: man xyz - | col -b > xyz.txt
:
: This will give you a plain-text copy of the manpage for 'xyz' in a text file.
: You can then do what you like to search it.
:
: Kevin

Let me put in a plug for PolyGlotMan (fka RosettaMan): http://polyglotman.sourceforge.net/
It's distributed along with tcl/tk (because it is the engine behind TkMan - IMHO the
best visual man reader). The executable, rman, translates to various formats
including text. Its text output is vastly superior to that produced using col because
it strips out extra blank lines and page breaks and other annoyances giving
you very clean output. It can also produce HTML output and can be linked
to a web server to provide a hyper linked system (TkMan also acts as hypertext.)

You've got the link above.

Dan Mercer

:
: ps - I have noticed a high volume of posts from you in both this group and
: comp.lang.perl.misc that could be solved by actually SEARCHING for an answer
: and/or reading the FAQs and/or reading man pages (and perldocs). Use of
: google.com and groups.google.com is highly recommended. While most folks don't
: mind answering questions, after a while we get tired of seeing the same
: questions repeated over and over again.


Kevin Collins

2004-05-22, 10:28 pm

In article <oU6rc.12968$zn.7437@twister.rdc-kc.rr.com>, Dan Mercer wrote:
>
> "Kevin Collins" <spamtotrash@toomuchfiction.com> wrote in message news:slrncapllk.hc2.spamtotrash@doom.unix-guy.com...
>: In article <opr79v6xbbuj0cst@news.singnet.com.sg>, Edward Wijaya wrote:
>: > Hi,
>: >
>: > Is there a way to search a text within
>: > a Manpage with bash?
>: >
>: > Man itself doesn't seem to have any
>: > particular command right?
>: >
>: > Regards
>: > Edward WIJAYA
>:
>: Others have already mentioned the man page for 'man' and using the '/' and '?'
>: search keys. Another good tip to know is to use:
>:
>: man xyz - | col -b > xyz.txt
>:
>: This will give you a plain-text copy of the manpage for 'xyz' in a text file.
>: You can then do what you like to search it.
>:
>: Kevin
>
> Let me put in a plug for PolyGlotMan (fka RosettaMan): http://polyglotman.sourceforge.net/
> It's distributed along with tcl/tk (because it is the engine behind TkMan - IMHO the
> best visual man reader). The executable, rman, translates to various formats
> including text. Its text output is vastly superior to that produced using col because
> it strips out extra blank lines and page breaks and other annoyances giving
> you very clean output. It can also produce HTML output and can be linked
> to a web server to provide a hyper linked system (TkMan also acts as hypertext.)
>
> You've got the link above.


Thanks, Dan. I can see that it is probably very useful. In most cases I just
search with the given PAGER, but I keep the 'col' trick at my disposal for
cases when I *know* something is in there but I just can't find it Then I'll
use vi/ grep, etc...

> Dan Mercer
>

-snip-

Kevin
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com