[ Table Of Contents ][ Answer Guy Current Index ] greetings   1   2   3   4   5   6   7   8 [ Index of Past Answers ]


(?) The Answer Gang (!)


By Jim Dennis, Ben Okopnik, Dan Wilder, Breen, Chris, and the Gang, the Editors of Linux Gazette... and You!
Send questions (or interesting answers) to

There is no guarantee that your questions here will ever be answered. Readers at confidential sites must provide permission to publish. However, you can be published anonymously - just let us know!


(?) Q: avoid getting answers from apropos in the man sections 3 and 3x

From Sándor Bárány

Answered By Mike Orr

Dear Answer Gang,
I am looking for a way to avoid getting answers to my apropos queries from the man sections 3 and 3x (ie I want to see only command names and no APIs). How can I do that without statically removing those man sections?
Regards,
S aacute;ndor B aacute;r aacute;ny
(!) [Mike] If you want to see only a certain section, you can pass that as the second argument to "man". For instance, "crontab" has two pages. "man 5 crontab" shows the file format, and "man 1 crontab" (or "man 8 crontab" on some systems) shows the command.
Apropos doesn't have any options, but man can be called as:

man -S 1:5:8 MyCommand
man --sections=1:5:8 MyCommand
to make it search only certain sections. In this case, it will display the first file it finds.
The easiest way to do what you want would be to have a shell script or function that greps the output of "apropos" to remove the unwanted lines:

#!/bin/sh
apropos $* | fgrep -v '(3)
(3X)'
Or if you like regular expressions:

#!/bin/sh
apropos $* | egrep -v '\((3|3X)\)'


This page edited and maintained by the Editors of Linux Gazette Copyright © 2001
Published in issue 71 of Linux Gazette October 2001
HTML script maintained by of Starshine Technical Services, http://www.starshine.org/


[ Table Of Contents ][ Answer Guy Current Index ] greetings   1   2   3   4   5   6   7   8 [ Index of Past Answers ]