Operating System - HP-UX
1826419 Members
3343 Online
109692 Solutions
New Discussion

Re: How to capture the output of top and normal text file of "man ls"?

 
Zhang Zhao gui
Frequent Advisor

How to capture the output of top and normal text file of "man ls"?

When I ran top >f1 and key in q to exit, I found that
f1 is very messy and contains garbage. It looks like
the same as when I ran "man ls >f2" and used vi to
edit it. "vi f2" also got a lot of garbage, Is there
any solution to solve this kind of problem?
5 REPLIES 5
Fernando Pena
New Member

Re: How to capture the output of top and normal text file of "man ls"?

Yes , one possible option :

# cd /usr/man/man1.Z
# cp ls.1 file.1
# mv file.1 file.1.Z
# uncompress file.1
# nroff file.1 > file.2

# vi file.2 <-- ASCII file

Goodbay !
Zhang Zhao gui
Frequent Advisor

Re: How to capture the output of top and normal text file of "man ls"?

But file.2 is no longer the same as the output of ls. In addition, comparing
to the original, some information are lost. I can't find the following info.
ls(1)
NAME
SYNOPSIS
ls [-abcdefgilmnopqrstuxACFLR1] [names]

l [ls_options] [names]
ll [ls_options] [names]
lsf [ls_options] [names]
lsr [ls_options] [names]
lsx [ls_options] [names]


As for the output of top command, even when I ran
top -d 1 >f1, I still got garbage when I 'vi' it,
I want to make use of this info in my script, how
can that be done?
Ivan Coenegrachts_1
New Member

Re: How to capture the output of top and normal text file of "man ls"?

Yes, there is a solution ...

# top > f1
q
# cat f1 | col -b > f2
# vi f2

-> also works with man-pages.

Best Regards,
Ivan.

Re: How to capture the output of top and normal text file of "man ls"?

There is and undocumented feature with top, which is to use the -f option to
write top output to a file.
You can specify any filename.

# top -f /tmp/topfile

You can use this feature in conjunction with other top options as documented on
the man page for top(1).
Zhang Zhao gui
Frequent Advisor

Re: How to capture the output of top and normal text file of "man ls"?

The command "cat f1|col -b >f2" generated an empty file f2 on my server.