I have the following sed command:
sed 's/\('\''\).*div><div>/,/'
which take everything between a single quote '
and div><div>
and replaces it with a comma ,
. Which works near enough perfectly to how I want it. However there are some lines that contains two div><div>
and my command is taking the second one to be its stoppping point, where I'm trying to cut it off at the first.
To try and provide more clarity, heres the line in the file that I am trying to extract data from:
'>Person A</a></div><div>Teaching A</div></div></td><td width='50%'><div style='height: 50px; margin-bottom: 6px;'><div style='font-weight:bold'>Unknown or external</div><div>Teaching B<
I am trying to replace everything up until Teaching A
so my output should look should like ,Teaching A
. However the output I am getting is ,Teaching B
.
How could I manipulate my sed command to pick up on the first instance of div><div>
instead of the last?
pup
to parse HTML files. github.com/ericchiang/pup