Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 mysql 转储中,我想删除包含某个类的所有链接标签,并留下(总是)包含在标签中的一个单词。
标签结构:
<a ..potential-other-stuff.. class="lexicon-term" ..potential-other-stuff.. >medium</a>
据我所知,这是没有意义的:
/<a class="lexicon-term" >[^ tab]\+<\/a>/
虽然 shellter 是对的,但这里有一个:
xmpl='<a ..potential-other-stuff.. class="lexicon-term" ..potential-other-stuff.. >medium</a>' echo $s | sed 's|<a [^>]* class="lexicon-term" [^>]*>\([^<]*\)</a>|\1|'
一些评论:
|
/
[^>]
.