Path a variable to sed that includes a path

Hi I'm trying to select text between two lines, I'm using sed to to this, but I need to pass variables to it. For example

start="BEGIN /home/mavkoup/data"
end="END"

sed -n -e '/${start}/,/${end}/g' doesn't work. I've tried double quotes as well. I think there's a problem with the / in the pathname. I've also tried using sed to replace them with \/ but I can't get that to work either.

Many thanks for your help.

Hi.

Replace the / with something else.

sed "s#....#....#"
sed "s!...!...!"
etc.

But the file I'm selecting text from already contains the path names. Replacing them in the file is not appropriate. My file has a bunch of

BEGIN path name

some text

END
BEGIN another path name

some text

END

I know the different path names used, example /home/mavkoup/data, home/mavkoup/info/ and so on.

I want to grep a specific BEGIN END block by using a variable and the block I want changes.

Oops. Sorry I misread your post.

Try with awk?

awk '$0 ~ S { p=1 }; p; $0 ~ E { exit }' S="$start" E="$end" file

I never got the hang of awk, and I can't get that command to work lol. I'll keep working on it.

---------- Post updated at 10:37 AM ---------- Previous update was at 09:36 AM ----------

Arg I'm annoyed. Here's my actual code:

Some process sets $var to:
var="/home/mavkoup/data"

start_f="BEGIN_FILE_INFO `echo ${var}`"

cat input.txt | sed -n -e "/${start_f}/,/END_FILE_INFO/p" > output.txt

I get the error sed: command garbled: /BEGIN_FILE_INFO /home/mavkoup/data/,/END/p

If instead I use
var="BEGIN_FILE_INFO" the code runs fine.

---------- Post updated at 10:53 AM ---------- Previous update was at 10:37 AM ----------

FYI I got it. Needed to figure out how to replace the / with \/ in the path. s/\//\\\//g wouldn't work, needed it to be s:\/:\\\/:g and then everything was good again!