linux - how to add space of a number after first four one space then after two one space etc using awk -


i want add multiple spaces of number "20120911162500" add space first 4 after every two.

desired output is

2012 09 11 16 25 00 

this tried:

echo "2012 09 11 16 25 00" |sed 's/.\{4\}/& /g' 

but output 2012 0911 1625 00.

this might work (gnu sed):

sed 's/../ &/3g' file 

this prepends space third pair of characters , every 2 characters thereafter.


Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -