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
Post a Comment