In Bash I have a file with following content:
05-24-2021,DIS,HostXYZ, ,,No connection possible,
05-24-2021,DIS,HostABC,BWV ,No connection possible,
06-18-2021,SID,HostWER,SE1 ,No connection possible,
06-18-2021,SID,"Host1:32115,Host2:32115", ,SOME TEXT,
06-18-2021,SID,HostZZZ, ,,
06-18-2021,SID,"Host3:32115,Host4:32115", ,ALSO SOME TEXT,
I want to search for a method to duplicate a line with 2 given hosts in it and separate them in 2 lines as follows:
05-24-2021,DIS,HostXYZ, ,,No connection possible
05-24-2021,DIS,HostABC,BWV ,No connection possible,
06-18-2021,SID,HostWER,SE1 ,No connection possible,
06-18-2021,SID,Host1, ,SOME TEXT,
06-18-2021,SID,Host2, ,SOME TEXT,
06-18-2021,SID,HostZZZ, ,,
06-18-2021,SID,Host3, ,ALSO SOME TEXT,
06-18-2021,SID,Host4, ,ALSO SOME TEXT,
Maybe you have any idea to transform that? I would really appreciate. I tried it with awk, sed and so on. I was able to duplicate (with "sed 's/:/:/p'") at least the affected lines but not to "filter out" the specific values.