I've got a line with an identifier, then a pattern (in my case, a semicolon) and then a list of numbers:
echo "sp16;111111111111111111111111111111211"
I'd like to insert a semicolon between all numbers as in (desired output):
echo "sp16;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;2;1;1"
So far, I found how to insert a semicolon between all characters using sed
:
sed 's/.\{1\}/&;/g'
But, then it also inserts semicolons before matching the first semicolon and also it adds a semicolon ad the end of the line.