This is a little tricky and a lot of people don’t use sed like this. But its actually not too hard to get a piece of a string.
Lets say we have:
herpderp.S14E90.tbn
We want the “14? and thats it. Here is a sed that will print that out. What we are doing is telling sed about the area around the 14 so it properly matches it and then using parenthesees to indicate what we want:
sed -n ’s/..S[0-9]+E([0-9]+)../\1/p’
Notice how we didn’t use \d because aparantly sed doesn’t support that. So we used “[0-9]” and to replicate the \d+ functionatlity, had to escape out the plus sign. You also have to escape out the parenthesees.
Thanks stackoverflow!