- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- just the option descriptors without all the man pa...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2008 12:41 PM
06-03-2008 12:41 PM
just the option descriptors without all the man page garbage
I wrote this question on experts exchange and they came up with a complicated command to parse the information I needed that I could alias for each system if need be.
If there is a better approach, I would love to know about it. Any help would be greatly appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2008 12:53 PM
06-03-2008 12:53 PM
Re: just the option descriptors without all the man page garbage
If you look at 'man man' there are very few options to the man command itself.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2008 01:04 PM
06-03-2008 01:04 PM
Re: just the option descriptors without all the man page garbage
Well, this gives a summary (albeit without each option's description):
# man command|col -b|awk '/NAME/,/DESCRIPTION/'
...replace 'command' with whatever you want summarized.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2008 01:29 PM
06-03-2008 01:29 PM
Re: just the option descriptors without all the man page garbage
I have not used it but it claims to come with "apropos" and "whatis" which is what you need.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2008 02:13 PM
06-03-2008 02:13 PM
Re: just the option descriptors without all the man page garbage
And pipe it to rmnl(1) to remove blank lines.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2008 08:04 PM
06-03-2008 08:04 PM
Re: just the option descriptors without all the man page garbage
Too bad you did not share the details.
Parsing man output is not hard, but not trivial either due to its 'stuttering' trying to 'overstrike' the key words.
For example, the line with ' SYNOPSIS looks like:
$ man awk| awk 'NR==12' | od -c
... S \b S \b S \b S Y \b Y \b Y \b Y N
So any matching looks ugly.
Here is an AWK solution, which you probably should put in a script or alias of ease of use:
$ COMMAND=awk
$ man $COMMAND 2>/dev/null | awk 'x {x=0;print $0} /S\bSY/ {x=1} / -\b-/'
awk [-Ffs] [-v var=value] [program | -f progfile ...] [file ...]
-F fs Specify regular expression used to separate
-f progfile Specify an awk program file. Up to 100 program
-v var=value Cause var=value assignment to occur before the
Using perl:
$ man $COMMAND 2>/dev/null | perl -ne '$p and print and $p=0; $p++ if /S.SY/; print if /^\s+-.-/'
or perl hiding the IFfy parts...
$ man tail 2>/dev/null | perl -ne '$p and print and $p=0; $p=/S.SY/; /^\s+-.-/ and print'
or perl picking up the command as argument for easy scripts / command line edit:
perl -e '$c=shift; foreach (qx(man $c 2>/dev/null)){if ($p){$p=0;print} $p++ if /S.SY/;print if /^\s+-.-/}'
so many ways...
:-)
hth,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2008 08:21 PM
06-03-2008 08:21 PM
Re: just the option descriptors without all the man page garbage
As shown in JRF's fragment, "col -b" removes that stuff.