How to Use vim to Realize Quick Number Arrangement

  question, vim

My document has this number:

123456
 223456
 333456
 443456

Want to use vim to organize into this appearance:

123456,223456,333456,443456

This file is very long, it is not efficient to make sure bit by bit. Is there any good way to record macros?

If the data of the branch is converted into comma-separated data, the following replacement command can be used:
:%s/$\n/, /g