I am receiving a query via a configuration file in unix, for ex. Config file content will be in the format:
Table_name|query
ABC|select ABC.A,ABC.B from PQR left join (select * from ABC) on ABC.pk=PQR.pk
I am trying to process query part as below :
while read line in config_file
do
query=`echo $line|awk -F "|" '{print $1}'`
result=hive -e "$query"
...
However the '*' in query variable is getting expanded to the listing of files in the current directory
Could you please help how to escape the *
character, i searched for the solution but could not find one.
$line
variable:echo "$line"
. For further information see for example When is double-quoting necessary? – steeldriver Jan 24 '20 at 12:16query=${line%%'|'*}
– Stéphane Chazelas Jan 24 '20 at 12:35