I am learning awk to advance my skills and tried
我正在学习awk以提升我的技能并尝试过
$ atq | awk "{print $1}"
28 Wed Oct 31 10:23:00 2018
27 Tue Oct 30 21:20:00 2018
25 Tue Oct 30 21:19:00 2018
29 Wed Oct 31 10:42:00 2018
26 Tue Oct 30 21:20:00 2018
20 Tue Oct 30 18:25:00 2018
30 Wed Oct 31 10:59:00 2018
32 Wed Oct 31 21:03:00 2018
23 Tue Oct 30 18:28:00 2018
31 Wed Oct 31 13:58:00 2018
19 Tue Oct 30 15:43:00 2018
21 Tue Oct 30 18:27:00 2018
It did not work as I expected, but it's relatively easy to work small programs together
它没有像我预期的那样工作,但是将小程序一起工作相对容易
$ atq | cut -f 1
28
27
25
29
26
20
30
32
23
31
19
21
How could I retrieve the first field using awk?
我怎么能用awk检索第一个字段?
1 个解决方案
#1
7
Try the below,
试试下面的,
atq | awk '{print $1}'
The single quotes stops the shell from expanding $1
to the shell's first positional parameter.
单引号阻止shell将$ 1扩展到shell的第一个位置参数。
#1
7
Try the below,
试试下面的,
atq | awk '{print $1}'
The single quotes stops the shell from expanding $1
to the shell's first positional parameter.
单引号阻止shell将$ 1扩展到shell的第一个位置参数。