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.
HTML ファイルから多数の文字列を抽出するスクリプトを実行し、すべてを新しいファイルにインポートしたいと考えています。より具体的には、 all<td>と</td>ペアの間の文字列を調べて、それらの間の文字列が length の場合は、文字列kを抽出します。
<td>
</td>
k
awkxml を解析するための適切なツールではありませんが、この単純なケースでは次の方法で十分です。
awk
awk '/<\/$/ && length == k + 2' RS='td>' k=$K input
これにより、各文字列と末尾の</. これはハックであり、信頼できる堅牢なソリューションとして扱うべきではありません。
</