LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Need to give input as addresses to a tool through awk (https://www.linuxquestions.org/questions/linux-newbie-8/need-to-give-input-as-addresses-to-a-tool-through-awk-860665/)

vinaytp 02-04-2011 05:22 AM

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

grail 02-05-2011 01:01 AM

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


vinaytp 02-07-2011 06:25 AM

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.

schneidz 02-07-2011 09:17 AM

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

take a look at expect.


All times are GMT -5. The time now is 07:46 AM.