Getting command output and putting into newfile


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Getting command output and putting into newfile
# 15  
Old 12-05-2008
Okay is there is someway that i run the command on TICLI "op:alarm,all"
and at the sametime try to grep the output of that command through log file.

The output of the command is something like this:

Code:
     CELL 3 PACKET PIPE (PP) 3
     CELL 3, CDM 1 CBR 3 TRANSMIT PORT (TXPORT) 1

     CELL 4 PACKET PIPE (PP) 1

     CELL 5 RECEIVE AMPLIFIER FAILURE 4
     CELL 5 RECEIVE AMPLIFIER FAILURE 6

     CELL 6 RECEIVE AMPLIFIER FAILURE 2

     CELL 7 TIME FREQUENCY UNIT (TFU) 1
     CELL 7 TEST AND DIAGNOSTIC UNIT 2
     CELL 7, CDM 1 PRIMARY SIGNALING LINK
     CELL 7, CDM 1 ALTERNATE SIGNALING LINK
     CELL 7 PACKET PIPE (PP) 2
     CELL 7 PACKET PIPE (PP) 3
     CELL 7 PACKET PIPE (PP) 4
     CELL 7 CDMA RADIO CONTROLLER (CRC) 1
     CELL 7, CDM 1 CDMA BASEBAND RADIO (CBR) 1
     CELL 7, CDM 1 CDMA BASEBAND RADIO (CBR) 2
     CELL 7, CDM 1 CDMA BASEBAND RADIO (CBR) 3
     CELL 7, CDM 1 CBR 1 TRANSMIT PORT (TXPORT) 1
     CELL 7, CDM 1 CBR 2 TRANSMIT PORT (TXPORT) 1
     CELL 7, CDM 1 CBR 3 TRANSMIT PORT (TXPORT) 1
     CELL 7, CDM 1 CBR 1 TRANSMIT PORT (TXPORT) 2
     CELL 7, CDM 1 CBR 2 TRANSMIT PORT (TXPORT) 2

But it will be little hard to get the exact output as command through log files as log file contain lots of data of others commands too.

What is the possibility and from where i start?
# 16  
Old 12-06-2008
background the TICLI "op:alarm,all" comand and tail the log file?

Code:
TICLI "op:alarm,all" &
tail -f /path/to/log |grep ^CEL\s.*$

Not sure if that is quite what you mean but there are MANY ways to do this, this is just one way.
# 17  
Old 12-06-2008
Hello All,

Code:
#/bin/ksh
/omp/bin/TICLI "op:alarm,all" &
tail -f /omp/omp-data/logs/OMPROP1/081206.APX | grep "CELL" > all

Now i am using the above code to run the command (op:alarm,all) on TICLI shell, and then trying to grep the output of command through the log file and then putting it into output file.
But now my question is that how i will stop the script when the output of the command will finish. I mean how i can make the script intelligent enough to stop giving output in the output file. And there is one more problem that because i am using grep on LOG file so it will also grep many other unwanted things.

Regards,
Waqas Ahmed
# 18  
Old 12-07-2008
If the above gives you all the output then try this;

Code:
#/bin/ksh
/omp/bin/TICLI "op:alarm,all" &
wait $!
tail -n 100 /omp/omp-data/logs/OMPROP1/081206.APX | grep "CELL" > all


This will wait until the background process is finished and then output all log entries that have "CELL" in them in the last 100 lines of the log.
# 19  
Old 12-12-2008
deleted

Last edited by wlewis; 03-07-2009 at 06:54 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Insert title as output of command to appended file if no output from command

I am using UNIX to create a script on our system. I have setup my commands to append their output to an outage file. However, some of the commands return no output and so I would like something to take their place. What I need The following command is placed at the prompt: TICLI... (4 Replies)
Discussion started by: jbrass
4 Replies

2. Shell Programming and Scripting

Need help putting output on one line

Good afternoon, I have been searching the web, and these forums for help. I will try my best to explain the issue, and what my desired results are. I am doing queries in MYSQL, and need the output to be sent to a file. That file needs to have things with the same ID on the same line. To... (14 Replies)
Discussion started by: brianjb
14 Replies

3. UNIX for Dummies Questions & Answers

Putting the Current -date in the Output File

Hi guys, Just want to ask how can I make a script that will perform like this. 1. Execute the command 2. Then the output of the command will be redirected to a file 2. The file that has been created will have a date on it equivalent to the date and time it was created (or maybe after the... (5 Replies)
Discussion started by: rymnd_12345
5 Replies

4. Shell Programming and Scripting

putting color on output file script

do you have any simple script on how to change the color and font of a string in a script example echo "====================================" echo " sample color script" echo "====================================" echo " hello " echo " bye" on hello,... (3 Replies)
Discussion started by: lhareigh890
3 Replies

5. Shell Programming and Scripting

Putting echo output as input to stat

I have a string with escape differentiators as a result of searching for a file using find. Essentially find returned to my shell variable several absolute paths each ending with the file name and each path/file separated by \n. Echo recognizes the escape sequence and is able to print the paths... (3 Replies)
Discussion started by: Ebodee
3 Replies

6. Shell Programming and Scripting

How to redirect the output to multiple files without putting on console

How to redirect the output to multiple files without putting on console I tried tee but it writes to STDOUT , which I do not want. Test.sh ------------------ #!/bin/ksh echo "Hello " tee -a file1 file2 ---------------------------- $>./Test.sh $> Expected output: -------------------... (2 Replies)
Discussion started by: prashant43
2 Replies

7. Shell Programming and Scripting

sed *.csv from file > newfile with /n

I have a an output file with a format: something blah1.csv blah2.csv blah3.csv somethingelse and I'm trying to use sed to pull all the *.csv entries out and put them 1 per line on a new file. I can't quite figure out how to write them to a new file with carriage returns, is there a simple way... (8 Replies)
Discussion started by: unclecameron
8 Replies

8. UNIX for Dummies Questions & Answers

Command display output on console and simultaneously save the command and its output

Hi folks, Please advise which command/command line shall I run; 1) to display the command and its output on console 2) simultaneous to save the command and its output on a file I tried tee command as follows; $ ps aux | grep mysql | tee /path/to/output.txt It displayed the... (7 Replies)
Discussion started by: satimis
7 Replies

9. Shell Programming and Scripting

How to compare 2 file to newfile......

Hi all Member i want compare 2 file to newfile I am new to shell script, just wanted you guy to help. example file A CM-00000BN_Oth-VAS-0000392 CM-00000BNSEED_Oth-Spe-0000392 CM-00000KJ_Pos-Pro-0000806 CM-00000KJ_Pos-Pro-0000810 CM-00000KJ_Pos-Pro-0000812 CM-00000KJ_Pos-Pro-0000814... (1 Reply)
Discussion started by: ooilinlove
1 Replies

10. Shell Programming and Scripting

Putting screen output in a log file

I want to output screen messages to a logfile when executing an automated script. I have tried the script and command to do this but with no luck. Thanks, Nicole (5 Replies)
Discussion started by: nsutti
5 Replies
Login or Register to Ask a Question