I have written:
ssh $ip_address "grep -i 20-10-2018 | awk -F "," '{print $2",""open_"$5}' result.csv" | while read line
do
        echo $Date":00:00",$line
done
This is throwing this error:
awk: {print ,open_} awk: ^ syntax error
Can anyone help?
I have written:
ssh $ip_address "grep -i 20-10-2018 | awk -F "," '{print $2",""open_"$5}' result.csv" | while read line
do
        echo $Date":00:00",$line
done
This is throwing this error:
awk: {print ,open_} awk: ^ syntax error
Can anyone help?
 
    
     
    
    Use a heredoc to run your commands over ssh:
ssh "$ip_address" << 'EOF'                 # shell will pass the heredoc as is to ssh because the end marker EOF is in quotes
    grep -i 20-10-2018 result.csv |        # I guess you meant to pass result.csv to grep, rather than awk
    awk -F "," '{ print $2",open_"$5 }' |  # good to put the parts of the pipeline on different lines for better readability
    while read line; do
      echo $Date":00:00",$line             # not sure what you mean by $Date here - probably $(date)?
    done
EOF
I am not sure what you mean by echo $Date":00:00".  I left that part intact.
See this post to understand how to quote awk commands:
Another useful post about using quotes in shell:
 
    
    You write double quotes inside the single quotes that is wrong. Any code write first double quotes after inside single quotes.
