can you please suggest how toHow do I pass variable within grep commandvariables into a grep command?
below hoard coded This hard-coded value is working:
startingLine=`grep -oP '(2017-01-03 )\w+.+' cv-batch.log | head -1`
echo $startingLine
but below parameterized version is notBut 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`
Update #1 -
Edit: I tried below commandthe following but it did not worked -didn't work either:
sartingLine=`grepstartingLine=`grep -oP '("$currDate" )\w+.+' cv-batch.log | head -1`