Sponsored Content
Top Forums Shell Programming and Scripting no data redirected to a file with top and grep - why? Post 302188584 by uvrakesh on Thursday 24th of April 2008 01:43:14 AM
Old 04-24-2008
MySQL

hi,
the direct answer for your 'why' is
->the output is not going to std out it is going to std err


secondly how to accomplish it
->method 1
$top 2>outputOfTop
or
$top >& outputOfTop

then
$grep pattern outputOfTop

->method 2
open two terminal term1 and term2

in term1
$mkfifo pipe
$top 2>pipe

in term2
$grep pattern pipe

make sure the working directory is same in both the terminal
i hope this should work

Best Regards,
Rakesh UV
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Collecting data from TOP to a file

Is there a way to collect data from top command to a file at regular intervals. I need this on HP-UX. I need to gather resident memory usage. I know that sar will give %cpu usage. There is a pmap command which gives memory usage in solaris. Is there a similar command in HP-UX Thanks (5 Replies)
Discussion started by: sssow
5 Replies

2. UNIX for Dummies Questions & Answers

Saving a redirected file

What command do I use in order to save a file in directory A/B/C to directory A/D/E. (1 Reply)
Discussion started by: JSP
1 Replies

3. Shell Programming and Scripting

tail -f a log file redirected into a new window?

Is this possible? I am attempting to display a new xterm window and tail -f the log file within that new window. I am currently working on a solaris 8 machine if that has any different meaning than the other platforms. As you can see, I am a newbie to this forum and to UNIX. Any help would be... (2 Replies)
Discussion started by: douknownam
2 Replies

4. AIX

search for a file - errors redirected

hi all, i do search for a file in solaris box in the following format find / -name 'file' -print 2>/dev/null i tried the same thing on AIX box; as i am searching from the root the same way i redirected the errors to /dev/null but find is showing strip off errors and when i just continued... (1 Reply)
Discussion started by: matrixmadhan
1 Replies

5. UNIX for Dummies Questions & Answers

Accessing redirected file inside script

hi, Is there a way to access the redirected file inside the script. Here is what the command line looks like: $ shar * > archive_file.arc I know I can't access the name of archive_file.arc with positional parameters like $1, $2.. Is there any way to figure out what file the output of the... (3 Replies)
Discussion started by: milhan
3 Replies

6. UNIX for Dummies Questions & Answers

redirected output not going to file for all cases

I have to confirm that an engine was not able to run. In the output below you see that it indeed got errors, but it didn't send those messages to the output file. When I run the same thing with a different executable it works. So does this mean something in the executable could cause it not to... (7 Replies)
Discussion started by: brdholman
7 Replies

7. Programming

Read redirected file from stdin in C (a.out < file)

Hello everybody, Having a file with the following content: 192.168.0.254->192.168.0.1 192.168.0.2->192.168.0.34 192.168.0.56->192.168.0.77 I need to code a program in C to read it from stdin redirection (i.e. root@box~# ./a.out < file), my question is, how can i do that? I've tried with... (2 Replies)
Discussion started by: semash!
2 Replies

8. Shell Programming and Scripting

Extracting specific lines of data from a file and related lines of data based on a grep value range?

Hi, I have one file, say file 1, that has data like below where 19900107 is the date, 19900107 12 144 129 0.7380047 19900108 12 168 129 0.3149017 19900109 12 192 129 3.2766666E-02 ... (3 Replies)
Discussion started by: Wynner
3 Replies

9. UNIX and Linux Applications

missing delimiters when mysql output is redirected to log file

Hi, Pls check that '|' and '+' present in Step-1 are not copied to log file in Step-3. Pls suggest how to get the exact output from Step-1 (i.e. with out losing '|' and '+') in to a log file ~Thanks Step-1: Execute command > mysql -utest -ptest -htesthost testdb -e "select * from... (3 Replies)
Discussion started by: newbielgn
3 Replies

10. Shell Programming and Scripting

Deleting redirected pwd from file.

Hi echo " username " read username echo "password" stty -echo read password stty echo through read i am taking standard input and redirecign them to a file echo " username=${username}/${password} " > file.lst now from the same shell script i want to delete the password (i.e... (4 Replies)
Discussion started by: rosheks
4 Replies
shevek::process(3)					     Library Functions Manual						shevek::process(3)

NAME
shevek::process - Create a process, optionally connection its standard in- and output streams to the calling program. SYNOPSIS
#include <process.hh> Inherits shevek::refbase. Public Member Functions Glib::RefPtr< shevek::fd > in () The standard input pipe, if it was requested. Glib::RefPtr< shevek::fd > out () The standard output pipe, if it was requested. Glib::RefPtr< shevek::fd > err () The standard error pipe, if it was requested. pid_t pid () The process ID. ~process () The destructor. This kills the process if it was still running. Static Public Member Functions static Glib::RefPtr< process > create (std::string const &command, std::list< std::string > &argv, bool pipe_stdin=true, bool pipe_stdout=true, bool pipe_stderr=true) Create a process from a filename and an argument list. static Glib::RefPtr< process > create (std::string const &command, std::list< std::string > &argv, std::list< std::string > const &envp, bool pipe_stdin=true, bool pipe_stdout=true, bool pipe_stderr=true) Create a process from a filename, an argument list and an environment. static Glib::RefPtr< process > shell (std::string const &command, bool pipe_stdin=true, bool pipe_stdout=true, bool pipe_stderr=true, std::string const &sh='/bin/sh') Run a string with the shell. static std::string run (std::string const &command, std::string const &sh) Run a process and return its output. static Glib::RefPtr< process > create (std::string const &command, bool pipe_stdin=true, bool pipe_stdout=true, bool pipe_stderr=true) Create a process without arguments. static Glib::RefPtr< process > create (std::string const &command, std::string const &a1, bool pipe_stdin=true, bool pipe_stdout=true, bool pipe_stderr=true) Create a process with one argument. static Glib::RefPtr< process > create (std::string const &command, std::string const &a1, std::string const &a2, bool pipe_stdin=true, bool pipe_stdout=true, bool pipe_stderr=true) Create a process with two arguments. static Glib::RefPtr< process > create (std::string const &command, std::string const &a1, std::string const &a2, std::string const &a3, bool pipe_stdin=true, bool pipe_stdout=true, bool pipe_stderr=true) Create a process with three arguments. static Glib::RefPtr< process > create (std::string const &command, std::string const &a1, std::string const &a2, std::string const &a3, std::string const &a4, bool pipe_stdin=true, bool pipe_stdout=true, bool pipe_stderr=true) Create a process with four arguments. static Glib::RefPtr< process > create (std::string const &command, std::string const &a1, std::string const &a2, std::string const &a3, std::string const &a4, std::string const &a5, bool pipe_stdin=true, bool pipe_stdout=true, bool pipe_stderr=true) Create a process with five arguments. static Glib::RefPtr< process > create (std::string const &command, std::string const &a1, std::string const &a2, std::string const &a3, std::string const &a4, std::string const &a5, std::string const &a6, bool pipe_stdin=true, bool pipe_stdout=true, bool pipe_stderr=true) Create a process with six arguments. static Glib::RefPtr< process > create (std::string const &command, std::string const &a1, std::string const &a2, std::string const &a3, std::string const &a4, std::string const &a5, std::string const &a6, std::string const &a7, bool pipe_stdin=true, bool pipe_stdout=true, bool pipe_stderr=true) Create a process with seven arguments. static Glib::RefPtr< process > create (std::string const &command, std::string const &a1, std::string const &a2, std::string const &a3, std::string const &a4, std::string const &a5, std::string const &a6, std::string const &a7, std::string const &a8, bool pipe_stdin=true, bool pipe_stdout=true, bool pipe_stderr=true) Create a process with eight arguments. static Glib::RefPtr< process > create (std::string const &command, std::string const &a1, std::string const &a2, std::string const &a3, std::string const &a4, std::string const &a5, std::string const &a6, std::string const &a7, std::string const &a8, std::string const &a9, bool pipe_stdin=true, bool pipe_stdout=true, bool pipe_stderr=true) Create a process with nine arguments. Detailed Description Create a process, optionally connection its standard in- and output streams to the calling program. Member Function Documentation static std::string shevek::process::run (std::string const &command, std::string const &sh) [static] Run a process and return its output. A convenience function for running a process and catching its standard output in a string. This blocks until the process has exited. static Glib::RefPtr<process> shevek::process::shell (std::string const &command, boolpipe_stdin = true, boolpipe_stdout = true, boolpipe_stderr = true, std::string const &sh = '/bin/sh') [inline, static] Run a string with the shell. Note that the process is forked from the shell, and so does not get killed when the process goes away. Author Generated automatically by Doxygen for libshevek from the source code. libshevek Fri May 11 2012 shevek::process(3)
All times are GMT -4. The time now is 05:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy