我将使用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.
目前,许多“在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.
stackoverflow.com/questions/17988756/...
—
西罗桑蒂利新疆改造中心法轮功六四事件