Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
strace -T から合計時間を取得しようとしていますが、次のように報告されています。
pid コマンド [時刻]
(システムコールごと)
[time] を合計したいと思います。私は gawk を使用していますが、最後のフィールドには $NF でアクセスできることを知っています。ただし、 $NF は時間だけではなく [time] (括弧付き) を報告しますが、これは明らかに合計できません。そのため、 [time] の代わりに時間を取得するにはどうすればよいでしょうか?
ありがとう
フィールドセパレータを変更することで、「[time]」の「time」に到達できます。
awk 'BEGIN {FS="[\\[\\]]"}; {print $(NF-1)}'