Register
It is currently Fri Oct 24, 2014 2:29 am

script for extracting informations from strace


All times are UTC - 6 hours


Post new topic Reply to topic  [ 4 posts ] 
Author Message
 PostPosted: Thu Jan 17, 2008 11:09 am   

Joined: Thu Jan 17, 2008 11:05 am
Posts: 1
Hi

I need script for extracting opened files filepaths from strace output.
For example:
...
open("/foo/bar") = 3
...
my script should return
...
/foo/bar
...
for each open returned by strace my scipt should return line containing filepath

Thx


Top
 Profile  
 PostPosted: Fri Jan 18, 2008 3:46 pm   
Moderator
User avatar

Joined: Wed May 03, 2006 2:05 pm
Posts: 242
This probably isn't the most reliable way to do it but you can try this:

Code:
grep open /tmp/log | awk -F\" '{print $2}'


You might want to try getting fancy with egrep and regular expressions... I'm out of practice :(

I hope this helps!


Top
 Profile YIM  
 PostPosted: Tue Jan 29, 2008 5:59 am   
Moderator
User avatar

Joined: Thu Oct 11, 2007 7:12 am
Posts: 229
Location: London - UK
i didn't check strace output but based on previous reply this is more efficient...

Code:
awk -F\" '/^open/ { print $2 }' /path/to/logfile


Top
 Profile  
 PostPosted: Tue Jan 29, 2008 12:57 pm   
Moderator
User avatar

Joined: Wed May 03, 2006 2:05 pm
Posts: 242
Thanks Wavy, that does make more sense :)


Top
 Profile YIM  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP