Between first occurrence of Cat to next occurrence of Cat, it should create a separate line with delimiter as ,.File input  as below.CatAABBCCCatAA-1BB-1CC-1Output expected:Cat,AA,BB,CCCat,AA-1,BB-1,CC-1
Merge lines between keywords into one-line comma separated values
text processing;awk;sed;perl