Hi,i have a little sed problem in my BASH script
Here's the deal:
from the input string :"SELECT Name WHERE Stock >=15 AND Price<=10", i would like to transform that to :
"$4 >=15 && $3 <=10" and put the result in a variable for further use in a awk . 3 and 4 are the values of previously declared variables STOCK=4 , PRICE=3
here's my sed:
CONDITION=`_s_upper_case "$2"`
CONDITION=`echo "$CONDITION" | sed -e 's/\(^.*WHERE \)//' |\
sed -e 's/AND/\&\&/g'| sed -e 's/OR/\|\|/g' | sed -e "s/\([A-Z]+\)/$$&/g"`
I try to insert \$$ before each character string but it doesn't work,
I understand there must some use of eval to replace STOCk and PRICE
by their numerical value but i can't figure it out
Any Help would be greatly appreciated!