cut in line

hi
how can i get from
Komendant st. house 50 ex. 1 fl. 1000 to > Kome.50.2.1000
Elsestreet house 51 ex. 2 fl. 11 to > Else.51.2.11
???

Where did you get "28"?

for string in "Komendant st. house 50 ex. 1 fl. 1000" \
              "Elsestreet house 51 ex. 2 fl. 11"
do
  a=${string%"${string#????}"} ## put first four characters in $a

  set -f
  set -- $string
  set +f
  shift $(( $# - 5 ))

  echo $a.$1.$3.$5
done

Excuse, was mistaken at input

thnx for script ,
can you tell me how to set first four characters to upper case?

a=$( printf "%s\n" "$a" | tr [:lower:] [:upper:] )

In ksh:

typeset -u a

In bash4.0:

a=${a^^}