How to use variables in linux regex pattern?

I need to execute a sed command with pattern /^03.06.2014/ in a .sh script & command line. The date is a variable not a constant. How could i implement this? When I use a variable inside a regex pattern, the command breaks. Do I need to escape something here? Any help is appreciated. Thanks!

date=$(date +%m.%d.%Y)
sed -n '/^$date/,$p' filename


Use double quotes for variable expansion in sed

sed -n "/^$date/,\$p" filename

You need to use double quotes to allow for shell expansion. You'll need to escape the $ meaning EOF.

sed -n "/^$date/,\$p" filename

Need Your Help

Application UI Issue with Samsung S3 and S4 (4.2.2+)

android user-interface menu samsung-mobile

I have an application that works fine on different devices, including Google Nexus 4 (4.4.2), Nexus S (4.1.2) and Samsung S3 (4.1.*), but I am having display issues with menu inflation on S3 and S4...

is Laravel Homestead essential?

laravel homestead

I'd like to setup and use Laravel as a PHP framework. I faced with Homestead.