The UNIX and Linux Forums  

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




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #6 (permalink)  
Old 05-26-2009
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,557
Quote:
Originally Posted by padhu.47 View Post
Hi All, thanks for the reply ....
i dont have python or perl ....
I have only ksh, bash, sh, csh

please help me
then use awk

Code:
awk -F"," 'BEGIN{
 t["1"]="6"
 t["2"]="7"
 t["3"]="8"
 t["4"]="9"
 t["5"]="0" 
}
{
 s=""
 for(i=1;i<=4;i++){
  if( substr($2,i,1) in t ){
     s=s t[substr($2,i,1)]
  }else{
     s=s substr($2,i,1)
  }   
 }
 $2=s substr($2,5)
}
1
' OFS="," file