# How to replace multiple newlines with two newlines in ingest pipeline gsub

**URL:** <https://discuss.elastic.co/t/how-to-replace-multiple-newlines-with-two-newlines-in-ingest-pipeline-gsub/350570>\
**Category:** Elasticsearch\
**Tags:** ingest-pipeline\
**Created:** [January 8, 2024, 11:04am UTC](https://discuss.elastic.co/t/how-to-replace-multiple-newlines-with-two-newlines-in-ingest-pipeline-gsub/350570 "2024-01-08T11:04:19Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [January 8, 2024, 3:15pm UTC](https://discuss.elastic.co/t/how-to-replace-multiple-newlines-with-two-newlines-in-ingest-pipeline-gsub/350570/2 "2024-01-08T15:15:01Z")

</div>

Hi @Bowfish

I thought we answered this here

Please Do not Open multiple topics with the same question.

Is there something different here

> [@How to replace multiple new lines with one in Ingest Pipeline gsub](https://discuss.elastic.co/t/how-to-replace-multiple-new-lines-with-one-in-ingest-pipeline-gsub/350127/4):
>
> Now it is just a regex exercise I am not a regex expert... but I did a quick google search found [this](https://stackoverflow.com/a/701658) POST \_ingest/pipeline/\_simulate { "pipeline": { "processors": [ { "gsub": { "field": "message", "pattern": "\\\n+", "replacement": "\\\n", "ignore\_missing": false, "description": "Replace multiple newlines", "on\_failure": [ { "append": { "description": "Record error informa…

---

_[View the full topic](https://discuss.elastic.co/t/how-to-replace-multiple-newlines-with-two-newlines-in-ingest-pipeline-gsub/350570)._
