Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Could such a script scrub duplicate chars in a text file?' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Could such a script scrub duplicate chars in a text file?
Authored by: babbage on Aug 09, '02 10:12:14AM
You can do what you're asking for within 'man' itself, using syntax similar to that of the vi editor. Here's the help screen you get
Most commands optionally preceded by integer argument k.  Defaults in brackets.
Star (*) indicates argument becomes new default.
-------------------------------------------------------------------------------
<space>                 Display next k lines of text [current screen size]
z                       Display next k lines of text [current screen size]*
<return>                Display next k lines of text [1]*
d or ctrl-D             Scroll k lines [current scroll size, initially 11]*
q or Q or <interrupt>   Exit from more
s                       Skip forward k lines of text [1]
f                       Skip forward k screenfuls of text [1]
b or ctrl-B             Skip backwards k screenfuls of text [1]
'                       Go to place where previous search started
=                       Display current line number
/<regular expression>   Search for kth occurrence of regular expression [1]
n                       Search for kth occurrence of last r.e [1]
!<cmd> or :!<cmd>       Execute <cmd> in a subshell
v                       Starts $EDITOR or /usr/bin/vi at current line
ctrl-L                  Redraw screen
:n                      Go to kth next file [1]
:p                      Go to kth previous file [1]
:f                      Display current file name and line number
.                       Repeat previous command
-------------------------------------------------------------------------------

This could all be inherited from the current $EDITOR environment variable, and seeing as I haven't currently set $EDITOR it might be defaulting to the 'more' pager command. In other words, if you want to page through files with a different pager then set $EDITOR and the man command will use it instead.

*testing...*

No, the variable to set seems to be $PAGER, not in this case $EDITOR. So, if you want to use the less command (which has a much richer syntax) and you're using the default tcsh as your shell, then run "setenv PAGER less" to add the variable to your current enviromnent [or put this in a login script so that it works all the time] and then run man again. It should now support more interesting syntax than that offered by, well, 'more'. Sure enough, I test this now as I'm writing, setting less as my $PAGER and then viewing a long manpage, and when I hit 'h' to bring up help I get a different display than what you see above -- much more than can be reasonably pasted into this form. See for yourself if you'd like to try it :-)

[ Reply to This | # ]