0

I need to grep some data from other hosts, but i can't able to get here and store as variable. below are the commands which was I facing. Please suggest me.

DATE="2019-12-19 12:32:11"
LOG_FILE="/tmp/my_log"

ssh my_host grep -oPz "(?s)$DATE.*" $LOG_FILE | grep -i ERROR

bash: -c: line 0: syntax error near unexpected token `(' 
5

1 Answer 1

1

What I would do :

DATE="2019-12-19 12:32:11"
LOG_FILE="/tmp/my_log"

ssh my_host <<EOF
grep -oPz "(?s)$DATE.*" $LOG_FILE | grep -i ERROR
EOF

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .