I'm filtering the fourth column in a file using below command. it's working fine in the console
[User@ipaddress Now]$ creationTime="8:15 PM"
[User@ipaddress Now]$ awk -F, -v var="$creationTime" '{if($4==var) print}' input.txt
serial1,tech,EU,8:15 PM,gan
Added the same command in shell script but it's not working.
$ cat test.sh
creationTime=$(date -d '330 minutes' +"%l:%M %p")
echo $creationTime
awk -F, -v var="$creationTime" '{if($4==var) print}' input.txt
Output while execting the script
[User@ipaddress Now]$ sh test.sh
8:15 PM
input.txt
serial1,tech,APAC,8:09 PM,anz
serial1,tech,EU,8:15 PM,gan
input.txt