Hi,
I am new to shell scripting and is working on a script to extract lines from a log file between two time stamps using awk command. After some research I used following command:
awk '/01 Oct 2011/{p=1} /10 Oct 2011/{p=0} p' test.log >> tmp.log
This works fine. But now i want to convert the hard coded dates to variable and have following command, but that does not work. I do not see any error message either
date1="16 Oct 2011"
date2="17 Oct 2011"
awk -v "d1=${date1}" -v "d2=${date2}" '/d1/{p=1} /d2/{p=0} p' test.log >> tmp.log
Any help on this would be greatly appreciated. If you think there is a better way of doing this then please suggest.
Thanks in advance...