Sample Header Ad - 728x90

bash + grep only the time stamp from output

0 votes
1 answer
1027 views
we want to capture the time from the output and not the time from the command sshpass expected output Sun Jul 14 12:47:49 UTC 2019 Sun Jul 14 12:47:49 UTC 2019 Sun Jul 14 12:47:49 UTC 2019 but from the command we get: sshpass -p customer pssh -H "presto01 presto02 presto03" -l root -A -i "date" | grep '[0-9][0-9]:[0-9][0-9]:[0-9][0-9]' 12:45:45 [SUCCESS] presto01 Sun Jul 14 12:45:45 UTC 2019 12:45:45 [SUCCESS] presto03 Sun Jul 14 12:45:45 UTC 2019 12:45:45 [SUCCESS] presto02 Sun Jul 14 12:45:45 UTC 2019 we can do sshpass -p customer pssh -H "presto01 presto02 presto03" -l root -A -i "date" | grep '[0-9][0-9]:[0-9][0-9]:[0-9][0-9]' | grep -v "^\[" Sun Jul 14 12:50:24 UTC 2019 Sun Jul 14 12:50:24 UTC 2019 Sun Jul 14 12:50:24 UTC 2019 but this is ugly way
Asked by yael (13936 rep)
Jul 14, 2019, 12:50 PM
Last activity: May 15, 2025, 10:57 PM