# How remove multi delimiter in a file

**URL:** <https://discuss.elastic.co/t/how-remove-multi-delimiter-in-a-file/206999>\
**Category:** Elasticsearch\
**Created:** [November 7, 2019, 6:36pm UTC](https://discuss.elastic.co/t/how-remove-multi-delimiter-in-a-file/206999 "2019-11-07T18:36:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![atchyuth](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@atchyuth](https://discuss.elastic.co/u/atchyuth)\
**Post date:** [November 7, 2019, 6:36pm UTC](https://discuss.elastic.co/t/how-remove-multi-delimiter-in-a-file/206999/1 "2019-11-07T18:36:10Z")

</div>

I have a file with each field separated by |~|. I am new to GROK pattern. Can someone help me build a custom pattern to remove the |~|. Empty or Null values should not be removed while processing.

The data structure is something like below:

000|~||~|2019270|~|1041|~|  
500|~|00001|~|99|~|2007065|~|N|~|C|~|0|~|0|~|D|~|0|~||~|N|~|0|~|R|~|0|~|0|~| |~|0|~|0|~| |~|1|~|Y|~| |~|0|~|0|~| |~|0|~|0|~|1|~|1|~|999999990|~|2780.00000|~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~||~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~||~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|.00|~|0|~|.00|~|0|~|0|~|0|~|D|~|0|~|N|~|0|~|N|~|0|~|N|~|0|~|N|~|REGULAR REVOLVING|~|N|~|0|~||~|0|~|Y|~|Y|~|1|~||~||~||~||~||~||~||~|B|~|1|~|F|~|1|~|X|~|1|~|F|~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~|REGULAR REVOLVING|~||~||~|.00|~||~||~||~||~||~|REGULIER|~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~|U|~|0|~||~||~|0|~|0|~| |~|0|~|  
500|~|00002|~|99|~|2007065|~|N|~|C|~|0|~|0|~|D|~|0|~||~|N|~|0|~|R|~|0|~|0|~| |~|0|~|0|~| |~|1|~|Y|~| |~|0|~|0|~| |~|0|~|0|~|1|~|1|~|999999990|~|2780.00000|~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~||~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~||~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|.00|~|0|~|.00|~|0|~|0|~|0|~|D|~|0|~|N|~|0|~|N|~|0|~|N|~|0|~|N|~|REGULAR REVOLVING|~|N|~|0|~||~|0|~|Y|~|Y|~|2|~||~||~||~||~||~||~||~|B|~|1|~|F|~|1|~|X|~|1|~|F|~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~|REGULAR REVOLVING|~||~||~|.00|~||~||~||~||~||~|REGULIER|~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~|U|~|0|~||~||~|0|~|0|~| |~|0|~|  
500|~|00003|~|99|~|2007065|~|Y|~|C|~|0|~|0|~|D|~|0|~||~|N|~|0|~|R|~|0|~|0|~| |~|0|~|0|~| |~|1|~|Y|~| |~|0|~|0|~| |~|0|~|0|~|1|~|1|~|999999990|~|2780.00000|~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~||~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~||~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|.00|~|0|~|.00|~|0|~|0|~|0|~|D|~|0|~|N|~|0|~|N|~|0|~|N|~|0|~|N|~|REGULAR REVOLVING|~|N|~|0|~||~|0|~|Y|~|Y|~|3|~||~||~||~||~||~||~||~|B|~|1|~|F|~|1|~|X|~|1|~|F|~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~|REGULAR REVOLVING|~||~||~|.00|~||~||~||~||~||~|REGULIER|~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~|U|~|0|~||~||~|0|~|0|~| |~|0|~|  
500|~|00004|~|99|~|2007065|~|N|~|C|~|0|~|0|~|D|~|0|~||~|N|~|0|~|R|~|0|~|0|~| |~|0|~|0|~| |~|1|~|Y|~| |~|0|~|0|~| |~|0|~|0|~|1|~|1|~|999999990|~|2780.00000|~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~|999999990|~||~|P|~||~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~||~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|0|~|.00|~|0|~|.00|~|0|~|0|~|0|~|D|~|0|~|N|~|0|~|N|~|0|~|N|~|0|~|N|~|REGULAR REVOLVING|~|N|~|0|~||~|0|~|Y|~|Y|~|4|~||~||~||~||~||~||~||~|B|~|1|~|F|~|1|~|X|~|1|~|F|~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~|REGULAR REVOLVING|~||~||~|.00|~||~||~||~||~||~|REGULIER|~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~||~|U|~|0|~||~||~|0|~|0|~| |~|0|~|

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 5, 2019, 6:36pm UTC](https://discuss.elastic.co/t/how-remove-multi-delimiter-in-a-file/206999/2 "2019-12-05T18:36:25Z")

</div>

Closed on December 5, 2019, 6:36pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
