File Handler of an Output


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers File Handler of an Output
# 1  
Old 12-13-2011
File Handler of an Output

Hi Guys,

I hope anyone could help me on my problem: (perl or shell)

I have this command:
Code:
ns cluster "ns snmp show status" all

Then the output is:
Code:
Command was launched from partition 0.


------------------------------------------------
Executing command in server server6
Event Text                     Mib                Trap Status


------------------------------------------------
Executing command in server server3
Event Text                     Mib                Trap Status


------------------------------------------------
Executing command in server backup-server
Event Text                     Mib                Trap Status


------------------------------------------------
Executing command in server server1
Event Text                     Mib                Trap Status


------------------------------------------------
Executing command in server server9
Event Text                     Mib                Trap Status


------------------------------------------------
Executing command in server server4
Event Text                     Mib                Trap Status


------------------------------------------------
Executing command in server server8
Event Text                     Mib                Trap Status


------------------------------------------------
Executing command in server server5
Event Text                     Mib                Trap Status


------------------------------------------------
Executing command in server server2
Event Text                     Mib                Trap Status


------------------------------------------------
Executing command in server server0
Event Text                     Mib                Trap Status


------------------------------------------------
Executing command in server server7
Event Text                     Mib                Trap Status

======= end ========

Question is: How can I capture the output and redirect it into a file without printing its debug output but instead putting it into a file. I already tried > and >> but none of these works.


Please advise,
rymnd_12345
Moderator's Comments:
Mod Comment Please use

code tags!

Last edited by vbe; 12-13-2011 at 09:52 AM.. Reason: code tags!
# 2  
Old 12-13-2011
You are saying that
Code:
ns cluster "ns snmp show status" all >cmd.out

does not work?
I know very few cases where it happens, so let me doubt...
Often the reason is a write issue, where did you send the output? does the user have the right to create etc. file there? If user is root are you sure you are not on some NFS/CIFS/NAS with security options set?
What was your exact sommand -as who - and the perms of the directory you send the output to ?
# 3  
Old 12-13-2011
Code:
 ls -lrt cmd.out
-rw-r--r-- 1 nsadm nsadms 0 2011-12-13 16:09 cmd.out

ty..
# 4  
Old 12-13-2011
If it's printing to stderr, that's FD 2, not FD 1. So try 2>filename.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl Signal Handler

I was working on some Perl code that does signal handling and I came across this one liner and wasn't sure what it was doing. local $SIG{__DIE__} = sub {$! = 2; die $_;}; I think the first part of the anonymous subroutine is setting $! to 2, but I am not sure what the second part is doing. ... (1 Reply)
Discussion started by: SFNYC
1 Replies

2. Shell Programming and Scripting

Dynamic output file generation using a input text file with predefined output format

Hi, I have two files , one file with data file with attributes that need to be sent to another file to generate a predefined format. Example: File.txt AP|{SSHA}VEEg42CNCghUnGhCVg== APVG3|{SSHA}XK|"password" AP3|{SSHA}XK|"This is test" .... etc --------- test.sh has... (1 Reply)
Discussion started by: hudson03051nh
1 Replies

3. Programming

Signal Handler Hangs

Hi, I have a problem with signal handler algorithm in linux. My code is hanging ( It is continuously looping inside the signal handler) . I am pasting my code here... Please provide me some help regarding this. I googled many places and wrote this code.. but doesnt seem to be working without... (6 Replies)
Discussion started by: sree_ec
6 Replies

4. Programming

SIGCHLD interrupts its own handler

Hi. I have a program whose job it is to manage 15 child processes. Sometimes these children die (sometimes deliberately other times with a SEGV). This causes a SIGCHLD to be sent to my program which uses waitpid() in the signal handler to gather information and, in most cases, restart the child.... (3 Replies)
Discussion started by: jrichemont
3 Replies

5. UNIX for Dummies Questions & Answers

Doubt with irq handler.......

Hello, I have develop a driver for my hardware and now, I need to handle a IRQ but I does not work. As I can understand, to handle a irq, it is necessary to make a request_irq(). If the return value is zero, ok, no problem to handle irq. Here is a easy example of my driver: #include... (8 Replies)
Discussion started by: webquinty
8 Replies

6. Shell Programming and Scripting

XML Handler in perl

Hi there, I'm newby in perl and XML. I can read and parse Xml with XML-Node upper XML::Parser, but how can I create XML tags and pack my individual data in it then send through socket. PLZ lead me :) Meanwhile what is your opinion about XML Writer library? Thanks in Advance. (2 Replies)
Discussion started by: Zaxon
2 Replies

7. Shell Programming and Scripting

Passing a file handler and an array from Perl to Shell Script

Hi there, I am trying to call a shell script from a Perl script. here is the code: @args = ("sh", "someshellprg.sh", "a file handler", "an array"); system(@args) == 0 or die "system @args failed: $?"; in the shell program, I examine if the arguments exits using: if then echo... (5 Replies)
Discussion started by: pinkgladiator
5 Replies

8. Programming

signal handler problems

Hey guys, I am trying to write a little shell, and was writing a signal handler to handle SIGINT (I am using 'stty intr ^C' and using ctrl-C to give SIGINT). I wrote this signal handler: void handle_sigint() { write(2,"handling sigint\n",16); write(1,"\nshell% ",8); } ... (4 Replies)
Discussion started by: blowtorch
4 Replies

9. Shell Programming and Scripting

File Handler in TCL

Hai , I Have Some x.txt file in which has the following data x.txt HI, How Are u r u fine /home/Sanju/samp.html /root/Sanju/design/sample now in tcl i have the following script set fp while { >= 0 } { puts $line ... (1 Reply)
Discussion started by: sanjustudy
1 Replies

10. Programming

signal handler for SIGCHLD

Hi, I have an c++ application which uses the function fork and execvp(). The parent does not wait until the child ends. The parents just creates children and let them do their stuff. You can see the parent program as a batch-manager. I have added a SIGCHLD handler to the program: void... (3 Replies)
Discussion started by: jens
3 Replies
Login or Register to Ask a Question