Transfer output of a proprietary command to a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Transfer output of a proprietary command to a file
# 1  
Old 11-22-2012
Transfer output of a proprietary command to a file

Hi Guys,

My problem looks simple. I have a software-proprietary command (not linux) that provides an output, let's say 200 lines.
Unfortunately the dumb coders of the software did not include the option ">" or ">>" which allows to transfer output to a file, so I need a way to do that using some linux trick (like print-screen and paste into a file).

Do you have any idea how can I do that ?

BR

Liviu
# 2  
Old 11-22-2012
Quote:
Originally Posted by liviusbr
Unfortunately the dumb coders of the software did not include the option ">" or ">>" which allows to transfer output to a file
It's not an 'option' that 'has to be included'. It's not something anything has built into it. All > and >> do is capture a program's standard output. It's something they must have worked pretty hard to intentionally avoid.

So the question is, what does this program send its output to, if not standard output?
# 3  
Old 11-22-2012
Hi,

It sends the output to the display but when I add ">" or ">>" it just outputs the first line into the file. I guess it's something related to the EOL character they might have badly implemented.
# 4  
Old 11-22-2012
Not sure if this will work, but can you try using tee:-
Code:
command | tee filename

# 5  
Old 11-22-2012
Hmmm, I dont think mixing that software's proprietary commands with linux commands would actually work I'll give it a try tomorrow.
What I was thinking, but not sure if it's doable :

1. launch a linux script that will perform a "print screen" of what's going to come next..
2. launching the software's command which outputs all lines
3. pasting the "print screen" content into a file.

Now I need a good idea of how that could be done..
# 6  
Old 11-22-2012
Quote:
Originally Posted by liviusbr
Hmmm, I dont think mixing that software's proprietary commands with linux commands would actually work I'll give it a try tomorrow.
It's probably not because it's "proprietary", but because of how it uses the terminal. Lots of Linux commands behave badly with redirection. Try redirecting the output of nano or vi or top -- won't work right, and you wouldn't even expect them to, because they're not programs that print line by line, they're interactive ones. They jump all over the terminal as they do things.

Put that file into a hex editor and it may surprise you; there may be things in it that don't show up in a terminal because it may be rewriting the same line over and over. It may contain control sequences that you wouldn't see by dumping it to a terminal.

You can use the script command to capture the output of any command that prints to the terminal. Whether the output will be useful later is a different question, since if it's not outputting line by line, it won't be stored line by line either.

Code:
script
some_command
exit

Then look at the contents of 'typescript'.

There is not a 'print screen' command for terminal, terminals don't work that way.

Last edited by Corona688; 11-22-2012 at 03:57 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. Red Hat

Command understanding the output file destination in case of standard output!!!!!

I ran the following command. cat abc.c > abc.c I got message the following message from command cat: cat: abc.c : input file is same as the output file How the command came to know of the destination file name as the command is sending output to standard file. (3 Replies)
Discussion started by: ravisingh
3 Replies

3. UNIX for Advanced & Expert Users

scp command for file transfer

I am not able to throw a file from server173 to server067 i.e. wlsuser@server173> scp /tmp/harsha.txt wlsuser@server067:/tmp fails However, I am able to pull a file from server173 onto server067's /tmp dir wlsuser@server067> scp wlsuser@server173:/tmp/harsha.txt /tmp... (2 Replies)
Discussion started by: shifahim
2 Replies

4. Shell Programming and Scripting

to take the output of a command to a file

hi , i am using iostat -nmzx 1 | awk '{ print $4 }' command to get the i/o rates of disks. but i want command output in a file , how can i capture , this is some what difficult because command output is keep on changing , any way i have to get total output of the command . please help me .... (1 Reply)
Discussion started by: shankr3
1 Replies

5. Shell Programming and Scripting

scp command for multiple file transfer.

FILE_LIST="{a.txt,b.txt,cal*}" scp -r $..$REMOTE_PATH$FILE_LIST $LOCAL_PATH This script passes only when all the three files are transfere, wat if only two file are transfered, but still I was to make the return code as pass. is it possible. (2 Replies)
Discussion started by: sangea
2 Replies

6. Shell Programming and Scripting

Transfer output to empty file?

Hi all, I want transfer the echo data into file.txt.how? echo " $dir $group " >> ${file.txt} ---------- Post updated at 04:11 PM ---------- Previous update was at 03:10 PM ---------- anybody can help ? i mean in script output like echo " hello" i want transfer that output to file.txt. (4 Replies)
Discussion started by: proghack
4 Replies

7. UNIX for Dummies Questions & Answers

getting Output of ls command in a file

Hi I am trying to get the output of ls into a file with names seaparated with comma and no spaces. Here is the content of my dir: ls file1 file2 file3 file4this is what I tried: ls -m > list.txtthe file 'list.txt' looks like: file1, file2, file3, file4, list.txtI... (25 Replies)
Discussion started by: jdhahbi
25 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. UNIX for Advanced & Expert Users

sftp command for file transfer

hi, I need to sftp a file from one unix system to another unix system. eg: filename is test.txt servername : abc@xyz please give me the sftp command for that. thanks in advance.. mohan.p (2 Replies)
Discussion started by: mohanpadamata
2 Replies

10. Shell Programming and Scripting

SCP file transfer command on solaris

I need to transfer multiple files using SCP between two solaris machines. Can somebody explain how to achieve that ? (3 Replies)
Discussion started by: parthum
3 Replies
Login or Register to Ask a Question