Я надішлю форму за допомогою cURL, де частина вмісту надходить з іншого файлу, вибраного за допомогою sed
Якщо param1використовується шаблон узгодження рядків з іншого файлу sed, команда нижче працює добре:
curl -d param1="$(sed -n '/matchpattern/p' file.txt)" -d param2=value2 http://example.com/submit
Тепер переходимо до проблеми. Я хочу показати лише текст між двома відповідними шаблонами, за винятком самого відповідного шаблону.
Скажімо, 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.
Наразі багато команд "між двома відповідніми шаблонами" 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.