hive -e "select key from hbcv_table a where a.col2 like \'%hello friend%\'" | sed 's/[\t]/,/g' >a.dat
getting errror like -
unexpected EOF while looking for matching `"'
Can any one please help how to fix it.
No need to shield single-quote:
hive -e "select key from hbcv_table a where a.col2 like '%hello friend%'" | sed 's/[\t]/,/g' >a.dat
Single quotes in the select statement should be passed to Hive literally. And within double-quotes, single quotes have literal meaning.