how to invoke external program and capture its output
Hi all,
I am using an external binary to view memory starting from a specific address and i want to automate this via PERL however there are problems. Hope you can help me ..thx
The output of the programme is like below:
I have around 30K of addresses which i want to send each to the programme above and split & save in a seperate log file ..i firstly tried to verify that programme executes and run properly for just 1 address in the list, however i can`t see all the output ( see just 1 line) when i run the perl script below:
============================================================
=============================================================
This gives the following output:
---------- Post updated at 11:23 AM ---------- Previous update was at 11:09 AM ----------
I think perl just cant see 80 in the command ..because the output is same as saying mem_disp <addr> without the number at the end..
Moderator's Comments:
Code tags for code, please.
Last edited by Corona688; 08-03-2012 at 01:30 PM..
I think you need to type ./myscript.pl, not myscript.pl, since PATH doesn't include the current directory for security reasons.
You certainly don't need perl to do something this simple -- especially when all you do in perl is run 30,000 more shells!! This does it all in one shell:
Thx but this is the initial step, I need to split the output and assign them to variables, make some arithmetic operation then save them in a seperate report file . i believe using perl for this makes sense.
Running 30,000 individual, separate shells to run 30,000 commands is wrong, period. That's like making 300 phonecalls to say 300 words. You never have to do that, even if you're processing the result in perl. There's also some useless use of backticks in there, though seeing it in perl is a first.
You could do the loop in shell and feed the result into perl through files or stdin, perhaps.
I don't know why it's taking 80 as a command. It shouldn't be, unless there's odd unprintable characters there which convince it it's on a different line. Or maybe a ; Did you copy-paste the code literally or is it slightly different from what you posted?
hmm thx i got it now ..ok will do that in shell and process the output in perl..well i copied and pasted , script is exactly what you see here ..anyway thanks for advice ,,
Hi,
I have create a Shell Script, with one function.
I want to call the script file in Java Program.
It working fine. but the problem is the function in the Shell Script is not executed.
Please suggest me,
Regards,
Nanthagopal A (2 Replies)
hi
i want to invoke a unix script in a C program and also return some value from the script to the C program to use that value further.
Basically i am doing a Lookup operation in this unix script and returning the looked up data from a oracle database table..
please help me invoke as well... (1 Reply)
How can i invoke java program from MC1, when I connect remotely to execute can I set classpath etc.
____________ <-------------->____________________
|..................|<-------------->|...............................|
|..................|<-------------->|...............................|... (2 Replies)
Hey all,
My boss tasked me with the job to write a script which would invoke various java programs, the thing is I don't know much about shell scripting so would you experts help me out?
Here is the requirement
- 2 applications written in java: App_A and App_B
-... (0 Replies)
This code is in my 'case' statement and it all else works fine.
The problem I have is that the value in 'procno' is not passed on to the external program (fireit).
It is passing all zeros instead of the actual process number.
By the time I get to this case statement, I know the "Number" and... (1 Reply)
I have a simple script like this:
for file in $dodfiles; do
./rundod $file
done
$dodfiles is an array of file names selected
rundod is a script which invokes a java progrm which process a data file
all the processing message logged into a log file
in order to extract and analyze the... (1 Reply)
I'm working on a script that will perform a backup, save a log of said backup and send the output to me in an email. Everything is working fine so far except that I can't figure out how to specify a maximum file size for the log file. I don't want a runaway log file jamming up the server.... (7 Replies)