Well, the 'ls' command can handle filenames with spaces in them, as can the 'find' command.
Yes, I know. Spaces are hard to deal with programming-wise (or should I say coding-wise?). They also make copy-and-paste more difficult, as filenames with spaces in them require dragging, and I need to avoid dragging so precisely, as I find it difficult and unpleasant.
These files were clips in Final Cut, and you can rename them as needed in Final Cut. It would have been very painful to be typing the underscores all the time. Hyphens mess up the double-click-to-select a file name, so those are out, too. I do avoid spaces for the names of FCP libraries and .mov files.
Yes, I know it's Unix. I used to be a Jr. systems administrator in Unix, Stratus, and a full-blown admin for OpenVMS years ago. Most people here refer to Unix as "Terminal", so I thought I'd go along with it. In fact, I mentioned "Unix in Terminal" in my OP. Yes, I know Unix (the Darwin kernel) is the engine under macOS.
Filenames containing spaces entered on the command line are indeed a pain. But I'm not asking for that. The 'ls' and 'find' commands don't seem to have a problem with that.
As for using spaces in filenames: Unix allows it, for whatever reason. I think the only illegal character for a filename in Unix is the slash (/), for obvious reasons! Apple coders also use spaces in filenames a lot.
The macOS Finder has its own problems.
Anyway, thanks for the script! As for compressing each column into a single space, I just thought I'd ask in case it were easy to do. Hmmm. Maybe I can write an 'awk' command to do it, or another script!
OK! (^_^)