Processing of text

From: Wyatt Song (wyatt.song@veritas.com)
Date: Sun Oct 06 2002 - 04:05:20 EDT


Take a man page as an example, text are divided into sub-sections like
 
NAME, SYNOPSIS, DESCRIPTION...FILES; SEE ALSO; NOTES; BUGS etc.
 
What is the best way to filter out text for one particular section. Say if
I wanted to only look at SEE ALSO section of a man page without scrolling
down to the bottom. I thought of either:
1. use an editor/viewer, for example: # man awk | less
2. use a script to process the text.
 
I'm really interested to find a solution using the 2nd method, but I'm not a
scripting expert, so any help is appreciated.
 
I thought of something like the following which I can then use in a script
# man printf | awk '/ALSO/ {print; getline; print;}'
 
I'm sure there can be more elegant solutions.
 
Thanks
Wyatt
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:25:03 EDT