473,396 Members | 2,082 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to invoke external progrmme 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:
Expand|Select|Wrap|Line Numbers
  1. bash-3.2$ mem_disp 12B21D20 100
  2. Opening RO Data Memory File scp.ro
  3. Opening Memory File CP2.16.0000000c.18.pmd.raw
  4. 12B21D20 12B6E500 186CAF00 12D81A00 00000010 *.....l..........*
  5. 12B21D30 000000AA 01060009 00000088 00000000 *................*
  6. 12B21D40 F05500FF 00019E02 00030000 00047849 *.U............xI*
  7. 12B21D50 0001013F 0001012F 805A0022 00593FC1 *...?.../.Z.".Y?.*
  8. 12B21D60 A5020000 480E05ED 00010000 00900058 *....H..........X*
  9. 12B21D70 00000000 00000000 00000000 00000000 *................*
  10. 12B21D80 43616C6C 50726F63 00000000 00000000 *CallProc........*
  11. 12B21D90 00000000 00000000 43616C6C 50726F63 *........CallProc*
  12. 12B21DA0 5F537663 5F534259 00000000 00000000 *_Svc_SBY........*
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:
================================================== ==========
Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl -w
  2. open (FILE, 'addr.txt');
  3. foreach my $line (<FILE>){
  4. $command = `mem_disp $line 80`;
  5. print "$command";
  6. }
  7. close (FILE);
================================================== ===========
This gives the following output:
Expand|Select|Wrap|Line Numbers
  1. bash-3.2$ split.pl 
  2. Name "main::command" used only once: possible typo at ./split.pl line 5.
  3. sh: line 1: 80: command not found
  4. bash-3.2$ split.pl 
  5. sh: line 1: 80: command not found
  6. Opening RO Data Memory File scp.ro
  7. Opening Memory File CP2.16.0000000c.18.pmd.raw
  8.  
  9. 12B21D20 12B6E500 *.... *
-------------------------------------------------------------------
Aug 3 '12 #1
1 1665
numberwhun
3,509 Expert Mod 2GB
That looks to be an error from the running of the command on line 4. If I were you I would drop into the shell and execute the command the way that the script is and ensure that it works the way that you expect.

Regards,

Jeff
Aug 6 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: konsu | last post by:
hello, when a web request comes to my index.php, i would like index.php to execute a php script stored in an external file and capture the external script's output to a variable. i am doing...
1
by: Pawel Banys | last post by:
Hello, There is an operation which can be performed at the shell prompt the following way: some_prg > result_file However, before "some_prg" can use files, they have to be converted and...
2
by: lkr | last post by:
how to capture java output from cammand line agrument using c#
1
by: Anoj Kumar | last post by:
Hi Guys! How to capture output of a console based program and display it on Windows Forms applcation. Thx Anoj Kumar
4
by: Peter A. Schott | last post by:
Not sure what I should do here. I know that DOS/CMD can capture the output of EXE files in Win32. I know that os.popen() has been recommended for this, but the couple of times I've tried, it...
1
by: sandy | last post by:
Hi, I am trying to invoke an external email management program from my ASP.NET web application. For testing purposes I created a very simple webform that has a single button. The code behind...
6
by: niskin | last post by:
I am running a system command and I need to capture the output so that, if the command has done what it is meant to, the program does something different. If I do this: int i; i=system("cd...
8
by: grikdog | last post by:
How to I capture stdout output from a system call and pipe it back into my running script? system "echo foobar"; # how to continue here with "foobar" in stdin ?? ... I can fake it with...
10
by: lalnamar | last post by:
I want to execute a unix time command using perl, and capture the output (specifically, the time it takes the command to execute). i tried using the system command: system("time command ");...
5
by: goje | last post by:
Hello I want to capture the Output of the External Console Application in my application and also want to send commands to External Console Application from my application. Someone have some...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.