I wrote the following code to determine which files a program writes to. I want to capture the filenames of course. strace -f -t -e trace=file -p 8804 2>&1 | grep -oP \(.*)\.*O_WRONLYThis outputs something like/tmp/11111111.txt, O_WRONLYThe problem is I can't pipe the output of all this to any commandstrace -f -t -e trace=file -p 8804 2>&1 | grep -oP \(.*)\.*O_WRONLY | echo# does not show anythingAnd also I can't save the output of all this for later use:strace -f -t -e trace=file -p 8804 2>&1 | grep -oP \(.*)\.*O_WRONLY > asd.out# file is emptyYour help is appreciated. :)
Grepping strace output gets hard
grep;pipe;strace
You can write the output to a file (with strace -o asd.out) and then grep it:From strace manual:-o filename Write  the  trace  output to the file filename rather than to stderr.  Use filename.pid if -ff is used. If the argument begins with`|' or with `!' then the rest of the argument is treated as a commandand all output is piped to it. This is convenient for piping thedebugging output to a program without affecting the redirections of executed programs.