inserting a character between string

i have a file contains like this:

i want to create a script that will insert a comma "." after the 10th character so it would be look like this

thanks in advance

bash

while IFS= read LINE
do
 echo ${LINE:0:10},${LINE:10}
done < "file"

If all the characters before the comma(,) are all digits, then you can do this by running the following command:
sed 's/^\([0-9][0-9]*\)/\1,/' a

Why not shorter :wink:

sed 's/^\([0-9][0-9]*\)/\1,/' a
# sed 's/^\(.\{10\}\)/\1,/' file
0100159457,Italy Accounts
0100159458,Italy Accounts

Why not shorter :wink:

# sed 's/./&,/10' file
0100159457,Italy Accounts
0100159458,Italy Accounts
0100162198,USA Accounts
1 Like