top and other interactive commands like it are prone to create outputs full of escape sequences that are difficult to view without a terminal, no matter how they're captured.
top itself can do this, so you don't need to kill it:
---------- Post updated at 11:21 AM ---------- Previous update was at 11:19 AM ----------
Quote:
Originally Posted by Shawn, Lee
The command is not 'top' and no command line options. Just top-like command.
It displays third-party app. engine's status...
Thanks,
If it works, it's not stupid, but whether and how well it will work depends on the application. The output might not be very readable without a terminal. It'd be better to get the output with the application's cooperation, if possible.
'cat myapp.out' may be misleading. When you do that in a terminal, the terminal will interpret escape sequences for you and present the output properly. But if you try sending that to a printer, or process it with commandline tools, you could find it full of gibberish.
Last edited by Corona688; 12-22-2011 at 02:09 PM..
Reason: thanks methyl
I am trying to check to see if a file exists on a ftp server, well, I know that cant be done, atleast directly, So I came up with this small script
ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
cd public_html/crap
dir $FILE
quit
END_SCRIPT
Where the $ variable... (2 Replies)
I'm having trouble capturing output from the following command on AIX:
grpck -n ALL > error.out
It gives me the results on the screen but my file is blank.
I have no trouble capturing output from "ls > ls.out", but doesn't seem to work with the grpck command.
Any ideas?
Thanks. (2 Replies)
Hi,
I'm new to ksh - unix platform. I'm writing a small script which will search my current directory and will search for file names which it takes input from the users.
Here is the code I'm having.
1 #!/bin/ksh
2 echo "enter a file name to be searched in the current dir : "
3 read... (1 Reply)
Hi all, I'd like to capture the output from the 'top' command to monitor my CPU and Mem utilisation.Currently my command isecho date
`top -b -n1 | grep -e Cpu -e Mem` I get the output in 3 separate lines.Tue Feb 24 15:00:03
Cpu(s): 3.4% us, 8.5% sy .. ..
Mem: 1011480k total, 226928k used, ....... (4 Replies)
hi,
I want to extract and save the cpu(s) information from top command output, but individual cpu statistics separately on a multi-processor machine.
In command line, top will show this statistics when we press the switch "1".
any ideas?
thanks,
meharo (3 Replies)
I have written shell script to send file as an attachemt of email and output of "top -o res" command as email body. it works fine if i execute manually from prompt but it does not send "top -o res" command output in email body when it is executed via crontab. Any suggestions. My script is below:... (5 Replies)
Hello all,
I've been woking on Solaris and Linux (Red Hat) so far but now I've inherited an HP-UX system and having minor issues with syntax...Appreciate if you could help me out here..
1) I'm trying to sort the output of the top command in HP-UX 11.11 by pressing O (capital O) after typing... (2 Replies)
Hi All,
In the output of TOP command in my unix system, i monitored that some process has utilization more than 100% even some process has 4000% utilisation.
Please help me understand how it is possible to show more than 100% utilization.
Please see the screenshot below:... (2 Replies)
need help with formatting output of command top and prstat. My requirment is to remove few columns and display remaining . But when i used awk to do that the output seems to be have gone vague, mixing the column values.
After using awk to print particular column the output seems to have lost... (1 Reply)
Hello,
I am a beginner, I have currently Solaris 11 on a vmware machine. Whenever I type a command like 'ls' the screen scrolls to the end of the screen. I am unable to see the entire list of directories and files. I have tried ls |page command, but looking out for a better option. (3 Replies)
Discussion started by: farheenprasad
3 Replies
LEARN ABOUT OSX
app::cli
App::CLI(3) User Contributed Perl Documentation App::CLI(3)NAME
App::CLI - Dispatcher module for command line interface programs
SYNOPSIS
package MyApp;
use base 'App::CLI'; # the DISPATCHER of your App
# it's not necessary putting the dispather
# on the top level of your App
package main;
MyApp->dispatch; # call dispather in where you want
package MyApp::List;
use base qw(App::CLI::Command); # any (SUB)COMMAND of your App
use constant options => qw(
"h|help" => "help",
"verbose" => "verbose",
'n|name=s' => 'name',
);
use constant subcommands => qw(User Nickname type); # if you want subcommands
# automatically dispatch to subcommands
# when invoke $ myapp list [user|nickname|--type]
# note 'type' lower case in first char
# is subcommand of old genre which is deprecated
sub run {
my ($self, @args) = @_;
print "verbose" if $self->{verbose};
my $name = $self->{name}; # get arg following long option --name
if ($self->{help}) {
# if $ myapp list --help or $ $ myapp list -h
# just only output PODs
} else {
# do something when imvoking $ my app list
# without subcommand and --help
}
}
package MyApp::List::User;
use base qw(App::CLI::Command);
use constant options => (
"h|help" => "help",
);
sub run {
my ($self,@args) = @_;
# code for listing user
}
pakcage MyApp::List::Nickname;
use base qw(App::CLI::Command);
use constant options => (
"sort=s" => "sort",
);
sub run {
my ($self,@args) = @_;
# code for listing nickname
}
package MyApp::List::type; # old genre of subcommand could not be cascading infinitely
use base qw(MyApp::List); # should inherit its parents command
sub run {
my ($self, @args);
# run to here when invoking $ myapp list --type
}
package MyApp::Help;
use base 'App::CLI::Command::Help';
use constant options => (
'verbose' => 'verbose',
);
sub run {
my ($self, @arg) = @_;
# do something
$self->SUPER(@_); # App::CLI::Command::Help would output PDOs of each command
}
DESCRIPTION
"App::CLI" dispatches CLI (command line interface) based commands into command classes. It also supports subcommand and per-command
options.
get_opt([@config], %opt_map)
give options map, process by Getopt::Long::Parser
interface of dispatcher
cmd_map($cmd)
find package name of subcommand in constant %alias
if it's finded, return ucfirst of the package name,
otherwise, return ucfirst of $cmd itself.
get_cmd($cmd, @arg)
return subcommand of first level via $ARGV[0]
SEE ALSO
App::CLI::Command Getopt::Long
AUTHORS
Chia-liang Kao <clkao@clkao.org> Cornelius Lin <cornelius.howl@gmail.com> shelling <navyblueshellingford@gmail.com>
COPYRIGHT
Copyright 2005-2006 by Chia-liang Kao <clkao@clkao.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See <http://www.perl.com/perl/misc/Artistic.html>
perl v5.16.2 2010-12-04 App::CLI(3)