I have below example file where I only need to see the text blocks starting with 100~|~ABCD123 and ending with the 310~ and its line content.
In here I am searching for the multi-line pattern:
It seems like all items get found (3), but the last 310~ field is not always an equal amount, thus only the first line of many is found.
How do I separate these complete text blocks from the file (to a new file) with only below result?
Code: Select all
100~|~|ABCD123
200~|~|A1234~|
300~|~|~|~|~|Eric~|Teststreet 1~|Testvillage~|~|~|~|~| 012 345 67 89~|
310~|Some information A1234-1
310~|Some information A1234-2
310~|Some information A1234-3
310~|Some information A1234-4
100~|~|DEFG2345
200~|~|A5678~|
300~|~|~|~|~|Jack~|Betasquare 2~|Happyspace~|~|~|~|~| 022 335 57 77~|
310~|Some information A5678-1
310~|Some information A5678-2
100~|~|ABCD123
200~|~|A1234~|
300~|~|~|~|~|Andrew~|Roundabout 7~|Cloudy~|~|~|~|~| 033 444 55 66~|
310~|Some other information A1234-1-1
310~|Some other information A1234-2-1
310~|Some other information A1234-3-1
100~|~|ABCD123
200~|~|A1234~|
300~|~|~|~|~|Dennis~|SunShine 7~|Sunvillage~|~|~|~|~| 098 765 43 21~|
310~|Some other information A1234-1-1
310~|Some other information A1234-2-1
100~|~|HIJK2345
200~|~|A5678~|
300~|~|~|~|~|Jack~|Pencil 2~|markerland~|~|~|~|~| 055 765 12 98~|
310~|Some information A5678-1
310~|Some information A5678-2
Code: Select all
100~|~|ABCD123
200~|~|A1234~|
300~|*
310~|*
How do I separate these complete text blocks from the file (to a new file) with only below result?
Code: Select all
100~|~|ABCD123
200~|~|A1234~|
300~|~|~|~|~|Eric~|Teststreet 1~|Testvillage~|~|~|~|~| 012 345 67 89~|
310~|Some information A1234-1
310~|Some information A1234-2
310~|Some information A1234-3
310~|Some information A1234-4
100~|~|ABCD123
200~|~|A1234~|
300~|~|~|~|~|Andrew~|Roundabout 7~|Cloudy~|~|~|~|~| 033 444 55 66~|
310~|Some other information A1234-1-1
310~|Some other information A1234-2-1
310~|Some other information A1234-3-1
100~|~|ABCD123
200~|~|A1234~|
300~|~|~|~|~|Dennis~|SunShine 7~|Sunvillage~|~|~|~|~| 098 765 43 21~|
310~|Some other information A1234-1-1
310~|Some other information A1234-2-1