1

Using MacOS High Sierra, trying to using grep to extract the text between two "tags." Intended output should be "The Genre". Here's the .txt file:

<genre>
The Genre
</genre>

Here's the grep command that's not working:

genre=$(grep -o '(?<=<genre>).*?(=<\/genre>)' textfile.txt)

echo $genre

I am approaching this the wrong way for MacOS? All the commands I've seen with tags only support BNU or Linux variants. Help appreciated

nwood21
  • 182
  • 10

0 Answers0