如何正则表达式strace过程?

How to regex strace process?

我正在尝试使用此命令跟踪多线程进程:

sudo strace -p1523 -e write -f

但是输出了很多不必要的信息示例:

[pid  1166] write(6, "[=11=][=11=]4716S5c1]2631]3e1c2a4"..., 517) = 517
[pid  1166] write(6, "[=11=]F[=11=][=11=]BA3764296p631Zt6xhi315"..., 126) = 126
[pid  1166] write(6, "0D4603O5K61`105y551456611z5"..., 413) = 413
[pid  1166] write(6, "[=11=]D4603O5L7362$U?a40s4)\5N0", 31) = 31
[pid  1166] write(1, "None\n", 5)       = 5

我如何才能仅跟踪此正则表达式 write\(1, "(.*)", [0-9]*\) 中的文本?

我试过:

sudo strace -p1157 -e trace=/write\( -f

#output ------------
strace: regcomp: write(: Unmatched ( or \(

#also
sudo strace -p1157 -e trace=/write\(1.*\).* -f
#output ------------
strace: invalid system call '/write(1.*).*'

strace 正则表达式在某些方面有所不同吗?

像这样:

sudo strace -f -p1523 -e write 2>&1 | grep -o 'write([^)]\+)'

:

sudo strace -f -p1523 -e write |& grep -o 'write([^)]\+)'

输出

write(6, "[=12=][=12=]4716S5c1]2631]3e1c2a4"..., 517)
write(6, "[=12=]F[=12=][=12=]BA3764296p631Zt6xhi315"..., 126)
write(6, "0D4603O5K61`105y551456611z5"..., 413)
write(6, "[=12=]D4603O5L7362$U?a40s4)
write(1, "None\n", 5)