awk to retrieve the first field report from atq
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I am learning awk to advance my skills and tried
$ 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?
bash awk
New contributor
add a comment |Â
up vote
1
down vote
favorite
I am learning awk to advance my skills and tried
$ 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?
bash awk
New contributor
1
You need single quotes around the awk commands.
â ewatt
40 mins ago
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I am learning awk to advance my skills and tried
$ 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?
bash awk
New contributor
I am learning awk to advance my skills and tried
$ 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?
bash awk
bash awk
New contributor
New contributor
New contributor
asked 47 mins ago
Sawajiri
1586
1586
New contributor
New contributor
1
You need single quotes around the awk commands.
â ewatt
40 mins ago
add a comment |Â
1
You need single quotes around the awk commands.
â ewatt
40 mins ago
1
1
You need single quotes around the awk commands.
â ewatt
40 mins ago
You need single quotes around the awk commands.
â ewatt
40 mins ago
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
5
down vote
Try the below,
atq | awk 'print $1'
The single quotes stops the shell from expanding $1
to the shell's first positional parameter.
great, could you please elaborate the reasons.
â Sawajiri
41 mins ago
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
Try the below,
atq | awk 'print $1'
The single quotes stops the shell from expanding $1
to the shell's first positional parameter.
great, could you please elaborate the reasons.
â Sawajiri
41 mins ago
add a comment |Â
up vote
5
down vote
Try the below,
atq | awk 'print $1'
The single quotes stops the shell from expanding $1
to the shell's first positional parameter.
great, could you please elaborate the reasons.
â Sawajiri
41 mins ago
add a comment |Â
up vote
5
down vote
up vote
5
down vote
Try the below,
atq | awk 'print $1'
The single quotes stops the shell from expanding $1
to the shell's first positional parameter.
Try the below,
atq | awk 'print $1'
The single quotes stops the shell from expanding $1
to the shell's first positional parameter.
edited 41 mins ago
Kusalananda
112k15216344
112k15216344
answered 43 mins ago
EBIN GLADSON
3816
3816
great, could you please elaborate the reasons.
â Sawajiri
41 mins ago
add a comment |Â
great, could you please elaborate the reasons.
â Sawajiri
41 mins ago
great, could you please elaborate the reasons.
â Sawajiri
41 mins ago
great, could you please elaborate the reasons.
â Sawajiri
41 mins ago
add a comment |Â
Sawajiri is a new contributor. Be nice, and check out our Code of Conduct.
Sawajiri is a new contributor. Be nice, and check out our Code of Conduct.
Sawajiri is a new contributor. Be nice, and check out our Code of Conduct.
Sawajiri is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f478890%2fawk-to-retrieve-the-first-field-report-from-atq%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
You need single quotes around the awk commands.
â ewatt
40 mins ago