perl -0777 -e"print =~ m[( \Q$ARGV[0]\E .*? \Q$ARGV[1]\E )]sxg" "#BG" "#EN" < yourinputfile >youroutputfile