Let's say that I have a file (example.txt) with the next structure:
NAAME 111 2222 333
NAMME 111 22 333
NNA ME 444 555 2
NNAAME 1 5 8
N MEEE 44 66 111
I would like to replace the spaces between the numbers with a separator, like |
or ,
but not affecting the name.
One option I was thinking is to change the space in the name and put a "low bar", then remove all the spaces in the file and write "|" and after change again the "_" in the name for a space.
Any idea how to do that in shell? Or maybe a better option?
The expect output would be this
NAAME|111|2222|333
NAMME|111|22|333
NNA ME|444|555|2
NNAAME|1|5|8
N MEEE|44|66|111
Thank you very much!