iframeのランダムなサイトのURLを置き換えるsed
質問
iframeで作成されたページがたくさんあり、それぞれが異なるURLまたは異なるIDを持っている ここに例があります
<iframe src="http://xxxxxx.xxxx/xxxx.xxx" width=xxx height=xxx style="visibility: hidden"><iframe>
または
<iframe src="http://xxxxxx.xxxx/xxxx.xxx?xxx=xxxx" width=xxx height=xxx style="visibility: hidden"><iframe>
ここで、すべてのxxxは時々ランダムです 私がする必要があるのは、このiframeを削除して空白にすることです このように
sed -i 's%<iframe src="xxx://xxxxxx.xxxx/xxxx.xxx?xxx=xxxx" width=xxx height=xxx style="visibility: hidden"><iframe>%%g' file
私の悪い英語についてごめんなさい 事前に感謝します
解決
質問はあまり明確ではありませんが、私が理解したことから、style =&quot; visibility:hidden&quot;のすべてのiframeを削除したいと思います。ファイルから。
このような何かがあなたのために働くはずです:
sed -i 's%<iframe[^>]+style="visibility: hidden"></iframe>%%g' file
...またはもう少し具体的に:
sed -i 's%<iframe src="[^"]+" width=[a-z0-9%]+ height=[a-z0-9%]+ style="visibility: hidden"></iframe>%%g file
所属していません StackOverflow