I have a long txt document I’m trying to extract the string in-between various tags. Below is the sample code in bash:
#!/bin/bash
genre=$(grep -o '(?< =).*(?=)' ~/Desktop/id3tagtest.txt)
echo $genre
The variable echos nothing–no errors just blank. I tried using the -oP flag but with the unix variant of grep that’s not valid. Below is a sample of the text I’m trying to extract from the .txt file.
some genre
How do I extract the text inbetween the two tags? Side note – the txt file is utf-8 encoded.