How do I pass variables into a grep
command? This hard-coded value is working:
startingLine=`grep -oP '(2017-01-03 )\w+.+' cv-batch.log | head -1`
echo $startingLine
But when I try to use a variable, it stops working:
currDate=$(date -d "$dataset_date" +%Y-%m-%d)
echo $currDate
startingLine=`grep -oP '($currDate )\w+.+' cv-batch.log | head -1`
Edit: I tried the following but it didn't work either:
startingLine=`grep -oP '("$currDate" )\w+.+' cv-batch.log | head -1`
grep
command – Wissam Roujoulah Jan 03 '17 at 10:35