grep - Getting a string between two string with sed -


i need extract (with sed or grep) substring between 2 strings.

the problem strings before , after html tags double quotes, spaces, etc...

this example of line want extract text:

12pt;">text_to_get</span></div></message> 

any welcome, in advance ;)

superficially, use sed:

sed 's%12pt;">\(.*\)</span></div></message>%\1%' 

or:

sed -n '/12pt;">\(.*\)<\/span><\/div><\/message>/ s%12pt;">\(.*\)</span></div></message>%\1%p' 

the first prints out non-matching lines unchanged; second prints out matching lines.

however, looking rigid context; if that's want, great, if need vary things, gets messy quite quickly. however, without indication of variations need accommodated, not possible give more flexible answer reliably.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -