Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I also believe that we all can contribute to each other's growth by sharing knowlege and experiences. I would love to take my skills and help people around the world solve problems..."

Geography

Where in the world do Tek-Tips members come from?

how to invoke external progrmme and capture its output

korcanUcar (Programmer)
3 Aug 12 9:05
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:

bash-3.2$ mem_disp 12B21D20 100
Opening RO Data Memory File scp.ro
Opening Memory File CP2.16.0000000c.18.pmd.raw
12B21D20 12B6E500 186CAF00 12D81A00 00000010 *.....l..........*
12B21D30 000000AA 01060009 00000088 00000000 *................*
12B21D40 F05500FF 00019E02 00030000 00047849 *.U............xI*
12B21D50 0001013F 0001012F 805A0022 00593FC1 *...?.../.Z.".Y?.*
12B21D60 A5020000 480E05ED 00010000 00900058 *....H..........X*
12B21D70 00000000 00000000 00000000 00000000 *................*
12B21D80 43616C6C 50726F63 00000000 00000000 *CallProc........*
12B21D90 00000000 00000000 43616C6C 50726F63 *........CallProc*
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:
============================================================
#!/usr/bin/perl -w
open (FILE, 'addr.txt');
foreach my $line (<FILE>){
$command = `mem_disp $line 80`;
print "$command";
}
close (FILE);
=============================================================
This gives the following output:

bash-3.2$ split.pl
Name "main::command" used only once: possible typo at ./split.pl line 5.
sh: line 1: 80: command not found
bash-3.2$ split.pl
sh: line 1: 80: command not found
Opening RO Data Memory File scp.ro
Opening Memory File CP2.16.0000000c.18.pmd.raw

12B21D20 12B6E500 *.... *
-------------------------------------------------------------------
max1x (Programmer)
13 Aug 12 14:21
Not really clear on your objective, so a shot in the dark
$pathToMemDisp = "/where/is/it";
chomp "$line";
print "$line";
$command = `$pathToMemDisp/mem_disp \"$line 80\"`;
goBoating (Programmer)
29 Aug 12 15:39
use IPC::Run;


Gives you the results, a timeout limit, any errors spit back through STERR, etc. Works very nicely.

'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close