Having trouble expanding variables with sed
I'm trying to use sed in a script to filter records in a log file by providing 2 variables (flight & Date)to the script. Each record is seperated by a blank line in the log.
My filter works (to look for flt 377 on 2013-05-09) as:
sed -e '/./{H;$!d;}' -e 'x;/scheduledFlightNumber>377/!d;/scheduledDepartureTimestamp>2013-05-09/!d' Logfile
but I want to be able to provide a flt# and date as arguments.
I've tried:
sed -e '/./{H;$!d;}' -e 'x;/scheduledFlightNumber>${flt}/!d;/scheduledDepartureTimestamp>${Date}/!d' Logfile
but it doesn't expand the ${flt} and ${Date}. I've also tried using "eval" in front of the sed command, but no joy.
This is my first post, but I've found many solutions previously (Thanks).
TIA for any future help.
|