I am trying to fetch only column using awk in OS commands like uname -a , uptime, using pssh multiple commands, But it's not giving correct output. Using "uname -a" is just an example i have shown, I meant to say awk is not working even any of the command, I tried only particular field of uptime via awk but no luck. Please let me know, if there is any possibility..
My need is to place the commands in same line and Below is the command, I'm trying, which gives correct output. But Not with awk
pssh -h /tmp/hosts -i 'echo "$(echo -n);$(date);$(uname -a)"'
[1] 13:41:35 [SUCCESS] server1
;Sun Jan 27 12:41:35 UTC 2019;Linux server1 3.12.74-60.64.99-default #1 SMP Tue Aug 14 07:11:35 UTC 2018 (d28148a) x86_64 x86_64 x86_64 GNU/Linux
[2] 13:41:35 [SUCCESS] server2
;Sun Jan 27 12:41:35 UTC 2019;Linux server2 3.12.74-60.64.99-default #1 SMP Tue Aug 14 07:11:35 UTC 2018 (d28148a) x86_64 x86_64 x86_64 GNU/Linux
Below is the commands using with awk command is Not working
pssh -h /tmp/hosts -i 'echo "$(echo -n);$(date);$(uname -a|awk '{print \$3}')"'
[1] 13:54:54 [SUCCESS] server1
;Sun Jan 27 12:54:54 UTC 2019;
Stderr: awk: cmd. line:1: {print
awk: cmd. line:1: ^ unexpected newline or end of string
[2] 13:54:54 [SUCCESS] server2
;Sun Jan 27 12:54:54 UTC 2019;
Stderr: awk: cmd. line:1: {print
awk: cmd. line:1: ^ unexpected newline or end of string