No output for ssh host "awk '{print $0}' /path/to/log.txt" -
i'm trying pull data out of logs on remote machines using awk, , have noticed if ssh machine , run
awk '{print $0}' /path/to/log.txt i expected output (containing log messages, stack traces, etc.), if run
ssh host "awk '{print $0}' /path/to/log.txt" then output looks following:
0 1 0 0 1 1 1 1 1 1 any ideas why may happening?
escape dollar sign.
ssh host "awk '{print \$0}' /path/to/log.txt" because single quotes don't protect $0 on local side, gets substituted befor it's sent remote side.
you try:
ssh host 'awk "{print \$0}" /path/to/log.txt' that protects $0 on remote side, takes more changes command.
Comments
Post a Comment