I have a grep command that gives the following string:
20121121001100 18 0 16 2 18
but I would like to modify this string to get
20121121 001 18 0 16 2 18
the above value are being extracted by the following:
for i in `ls -1 file.txt | sort`; do echo $i`
grep datetime $i | wc -l ``
grep abc $i | wc -l ``
grep def $i | wc -l ``
grep ghi $i | wc -l ``
grep jkl $i | wc -l ` ; done | cut -c9-500
cut -c9-500 is used because the original string is in the form of
datetime20121121001100 18 0 16 2 18
and cut -c9-500 returns
20121121001100 18 0 16 2 18
Can someone please help me to get
20121121 001 18 0 16 2 18
(ie remove the last 3 digits from the date part)