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

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -