Kindly tell us what operating system and shell you're using. (Which, as you know, you should tell us every time you start a thread in the Shell Programming and Scripting forum.)
With a POSIX conforming shell, you can easily use various variable expansions to get parts of a string and assignment to assign the reformatted data into another variable. With a csh derived shell, your options might be more limited.
With awk , you can easily use substr() and print or printf or sprintf (depending on what you want to do after that).
What have you tried to solve this problem on your own?
#!/bin/bash
# partition date string
# 20181004172000 ->
# 0000 00 00 01 11 11
# 1234 56 78 90 12 34 position 1 -15 bash uses zero index, so pos 1 = 0 for bash
# ---- -- -- -- -- --
# 2018 10 04 17 20 00 parititioned string
# %Y %m %s %H %M %s time format spec you are implying
string="20181004172000" # variable to split
# position index is zero based
dt="${string:0:4} ${string:4:2} ${string:6:2} ${string:8:2} ${string:10:2} ${string:12:2}"
echo "$dt"
I have to admit that your request is more than fuzzy. I am using bash by inference from the type of date command you seem to have -> implies bash may be on your system. If you cannot give details as Don and Rudi have asked for we cannot give you good answers.