LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-04-2011, 05:22 AM   #1
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 704

Rep: Reputation: 55
Need to give input as addresses to a tool through awk


Dear All,

we have a tool called trace which takes a memory address as input and gives the function name corresponding to that as output.

I have a file which has around 200 addresses, which needs to be given as input to this trace tool.

I can start the tool in this way.
Code:
trace main.file.map
trace> 0x7831bc39
function_name_as_output
trace>
There is another file called address.txt from which I need to feed these addresses to this tool.

Manually it takes lot of time to give the addresses which are in other file one by one. I have idea about some basic awk one liners.

Can anybody help me to start the script.

Thanks
 
Old 02-05-2011, 01:01 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,499

Rep: Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867Reputation: 2867
I would probably just use bash as calling out of awk to trace would be a waste.
Something like:
Code:
while read -r address
do
    trace $address # not sure exactly how you need to call it but I am sure you get the idea
done<addresses.txt
 
Old 02-07-2011, 06:25 AM   #3
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 704

Original Poster
Rep: Reputation: 55
Thanks a lot for the response grail.

As I can see, your script does well, if we are able to give Address directly to the trace tool. But we need to open the tool by giving a file name as input, later we can specify the address at trace> prompt.

Please check the example given at the beginning of the thread. Still I am not able to automate this issue.

Thanks again.
 
Old 02-07-2011, 09:17 AM   #4
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,112

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
if the trace program is prompting you for input then it wasnt meant to be automated.

take a look at expect.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] is there a traceroute-like tool that shows ports as well as IP addresses? carolus Linux - Newbie 5 01-31-2010 02:15 PM
? dhcpcd and dhclient give me two different IP addresses; static IP while using DHCP Lunixer Linux - Networking 4 03-17-2008 04:03 AM
shell script to read input from csv ip addresses? kr0m3 Programming 3 07-21-2007 08:51 AM
How to give an authenticated access to a web site for some IP addresses sharad Linux - Security 5 06-01-2006 07:15 AM
How to give authenticated access to a web site for perticular IP addresses sharad Linux - Networking 1 05-29-2006 03:40 AM


All times are GMT -5. The time now is 08:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration