Error while using multiple quotes

Aakash k.u.

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?

codeforester

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:

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

while using multiple in getting error in sql

Devise routing error while using multiple models - RAILS 4.2.0

Getting SQL error while joining the multiple table using PHP and MySQL

error: multiple repeat at position while using a regex pattern

Error Passing Multiple Inputs to a Class while using Numba

Syntax error while using multiple rename RENAME expressions postgresql

Chef Error while installing multiple packages using custom attributes

Error while referencing into a global variable using multiple files

Makefile Error while using GNU compiler: Multiple Target patterns

OUT OF MEMORY ERROR while using multiple gifs in a single activity

javascript slider error while using multiple slides in html

Inserting Multiple Double Quotes In A Cell Using VBA

Why is this code using multiple types of quotes

Formula with quotes into cell using VBA throws error

Escaped double quotes in JSON string causing error while parsing

Error Validation using 'while not in'

Error while using mycli

Error while using sklearn

Error while using chatterbot

Error while using Mantis

Error while using """

Error while using RecyclerView

Error while using If else

remove double quotes from csv while using open csv

Including double quotes while writing CSV using apache commons in java

Getting "No Session found for current thread" error while using multiple data sources using gorm with micronaut

Remove multiple double quotes using scala in JSON using regex

How to add both double quotes and triple Quotes in String header while generating CSV using CSVFormat

Problem while using multiple conditions in a 'while loop'