Hi everybody,
I did my best to try to describe my need in the title and hopefully somebody who already knows the answer is able to give me an answer.
A more lenghty description of my problem.
I have an input string which I get from a cURLed website:
Quote:
"One Two One Two One Two <div>Thread Title:Hello World</div> One Two One Two One Two"
|
Now, I want to get "Hello World" from this.
I can get the it including the "<div>Thread Title: ... </div>" part using pcregrep:
Code:
echo "$content" | pcregrep -o -e "<div>Thread Title:.*?<\/div>"
-> <div>Thread Title:Hello World</div>
But how can I only get Hello World? In Javascript I'd do
Code:
("One Two One Two One Two <div>Thread Title:Hello World</div> One Two One Two One Two").exec(/<div>Thread Title:(.*?)<\/div>/g)[1]
-> Hello World
But is there a tool that lets me do that on BASH? SED doesn't seem to be able to output anything but whole lines...
something like
Code:
echo $data|regexec "/<div>Thread Title:(.*?)<\/div>/" "1"
would be great!
Thank you in advance
Hans Schmucker
Mannheim
Germany