1 2 3 4 5 6 7 8 |
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!
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)\)'
1 2 3 4 5 6 7 8 |