cURLを使用してフォームを送信します。ここで、一部のコンテンツは他のファイルから取得され、 sed
param1を使用して他のファイルからのパターンに一致する行の場合sed、以下のコマンドは正常に動作します:
curl -d param1="$(sed -n '/matchpattern/p' file.txt)" -d param2=value2 http://example.com/submit
今、問題に行きます。一致するパターン自体を除く、2つの一致するパターン間のテキストのみを表示したい。
file.txt含まれているとしましょう:
Bla bla bla
firstmatch
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.
secondmatch
The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English.
現在、「beetween 2マッチングパターン」たくさんのsedコマンドが削除されませんfirstmatchとsecondmatch。
結果を次のようにしたい:
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.