Need to extract a folder from a full path

Hi everyone,

I have different folders which looks like this:

/mnt/ecrm/master/ecrm/templates/brochure/de_DE/zeitlos.ott
/mnt/ecrm/master/ecrm/templates/mail/en_US/default.html
/templates/header_and_footer/en_US/default.txt

I want to get the bold text only in a variable. I already have a regex prepared:
(\w+(?=\/\w+_\w)) => Get me the word before /anyword_anyword (here: de_DE or en_US)

But I don't know how the implement that into a bash shell script. I tried sed, which doen't support advanced regex and I am too stupid for awk.

Help?:wall:

With GNU Sed

sed 's|.*/\([^/]*\)/[A-Za-z_]*/.*$|\1|' inputfile > outfile

Another one with awk:

awk -F"/" '{print $(NF-2)}' infile

Thank you guys.