我被困住了。我有 html 文件:
Lorem ipsum Lorem ipsum
Lorem ipsum
Lorem ipsum
Random text123 </td></tr></table><a name="Preamble"</a> Random text
Lorem ipsum Lorem ipsum 123
Lorem ipsum 125
Lorem ipsum
我需要:
Random text
Lorem ipsum Lorem ipsum 123
Lorem ipsum 125
Lorem ipsum
我用了:
sed 's/.*<.td><.tr><.table><a\ name\=.*><.a>//g'
但它只剪切这一行中的字符,而不是之前的文本(我也认为 //g 正在剪切 doc 中的所有匹配模式,我只需要第一次出现)。
第二个问题:我有一个巨大的文件,例如:
Lorem ipsum Lorem ipsum
Lorem ipsum Lorem ipsum
Lorem ipsum
Lorem ipsum
Lorem ipsum<tag>Text that need to be changed
Text that need to be changed by multiple seds
Text that need to be changed Text that need to be changed by multiple sed
Text that need to be changed
Text that need to be changed </tag>Lorem ipsum
Lorem ipsum Lorem ipsum
orem<tag>Text that need to be changed
Text that need to be changed by multiple seds
Text that need to be changed Text that need to be changed by multiple sed
Text that need to be changed
Text that need to be changed </tag>Lorem ipsum
我只需要在开头和结尾的扇区上使用多个 sed 该怎么做?感谢您的任何回复!