The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 01-05-2007
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798

Code:
[/tmp]$ cat ./try.ksh
#! /bin/ksh

in=A12B3456CD78

f3=$(echo $in | tr '[A-Z]' ' ')
f3=${f3##* }
in=${in%$f3}
f2=$(echo $in | tr '[0-9]' ' ')
f2=${f2##* }
f1=${in%$f2}
echo "$f1"
echo "$f2"
echo "$f3"

[/tmp]$ ./try.ksh
A12B3456
CD
78
[/tmp]$