I have a large text file generated from strace which contains in brief :
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
42.93 3.095527 247 12512 unshare
19.64 1.416000 2975 476 access
13.65 0.984000 3046 323 lstat
12.09 0.871552 389 2239 330 futex
11.47 0.827229 77 10680 epoll_wait
0.08 0.005779 66 88 fadvise64
0.06 0.004253 4 1043 193 read
0.06 0.004000 3 1529 3 lstat
0.00 0.000344 0 2254 1761 stat
[...]
0.00 0.000000 0 1 fallocate
0.00 0.000000 0 24 access
0.00 0.000000 0 1 open
Excluding the first header line, I would like to get from each line the last field, corresponding to the syscall column. Those would include:
- unshare
- access
- lstat
- futex
- epoll_wait
- .
- ..
- ...
This is what I tried
tail -n -13 seccomp | awk '{print $5}'
, which has been able to ignore the first line but somehow some lines containing the error row are ignored due to my search been not refined.
How do i implement this?
$5
in awk doesn't work is that some of the lines have more fields than the others, namely the error column is empty in most lines, but not all of them. That sort of output is annoying to parse. – ilkkachu May 27 '22 at 17:57