I have the following text:serverName: NZRC222total: 8.46 GBserverId: 259695serverName: NZRC333total: 50.13 TBserverId: 260582serverName: NZRC555total: 9.31 TBserverId: 260956My desired output would be: serverName: NZRC222,total: 8.46 GB,serverId: 259695,serverName: NZRC333,total: 50.13 TB,serverId: 260582,serverName: NZRC555,total: 9.31 TB,serverId: 260956,Basically, I want to generate a csv file which can be imported to the Excel.When I go with :sed '/\w.*/ a ,' file I get this:serverName: NZRC222,total: 50.13 TB,serverId: 260582,serverName: NZRC333,total: 9.31 TB,serverId: 260956,Any suggestions? Thank you in advance!
How to append character to the end of line using SED?
text processing;sed;csv
You can replace non-empty lines with the line and comma:sed 's/.\+/&,/'orsed -E 's/.+/&,/'& stands for the matched text, which is the whole line here.