开发者

Remove page numbers from man pages in Solaris?

开发者 https://www.devze.com 2022-12-13 17:21 出处:网络
When I use Solaris, I get page numbers every 60 lines or so that look like this SunOS 5.11Last change: 10 Feb 2009开发者_运维百科1

When I use Solaris, I get page numbers every 60 lines or so that look like this

SunOS 5.11          Last change: 10 Feb 2009            开发者_运维百科        1

Also, I get headers like

User Commands                         ls(1)

Is there any way to remove them? It's distracting to have them appear when I'm reading text line by line.


man pages are generally troff-formatted documents, so short of editing the various pages to remove the actual text I don't think there's any way to not see them.


try this

man grep | nawk 'NR>2'| more


I ended up removing them by editing the standard macro package (nroff) at /usr/share/lib/tmac/an to not show headers and footers.


This is what I wrote to strip off these headers:

  /usr/bin/man $@ | nawk '
  BEGIN { i=0 }
  /SunOS 5.* *Last change:/ {
  for(j=0;j<i-3;j++) printf("%s\n",line[j]);
  for(j=0;j<10;j++) getline;
  i=0; continue;
  }
  { line[i]=$0; i++; }
  ' | ${PAGER:-more}
0

精彩评论

暂无评论...
验证码 换一张
取 消