The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: cut in line
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 03-18-2009
Trump Trump is offline
Registered User
  
 

Join Date: Mar 2009
Location: Russia
Posts: 23
Quote:
Originally Posted by cfajohnson View Post

Where did you get "28"?

Code:
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
thnx for script ,
can you tell me how to set first four characters to upper case?

Last edited by Trump; 03-18-2009 at 01:27 PM..