help me


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting help me
# 8  
Old 05-28-2007
Quote:
Originally Posted by ghostdog74
Code:
awk 'BEGIN{ 
       for(i=65; i<=90; i++) {  
          printf "%d %c\n", i, i
       } 
    }'


This was posted earlier. OP wants to store the values
Smilie
# 9  
Old 05-28-2007
thanx..
But I can not use the value of arr[i] outside of awk.
Could u plz tell me anothe way to get the ascii value of A an so on.
By this value I have to check and append that charecter with any string.
plz help.
# 10  
Old 05-28-2007
You can do something like that :
Code:
#!/usr/bin/ksh
# ScriptFile: newfile

filename=$1
name=${filename%?}
suffix=${filename#$name}
new_suffix=$(echo "$suffix" | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'BCDEFGHIJKLMNOPQRSTUVWXYZ_')

if [ "$new_suffix" = "_" ]
then
   echo "No new suffix avalaible for file $filename "
else
   new_filename="$name$new_suffix"
   echo "New filename : $new_filename"
fi

Examples :
Code:
$ newfile 098A
New filename : 098B
$ newfile 098M
New filename : 098N
$ newfile 098Z
No new suffix avalaible for file 098Z
$

Jean-Pierre.
# 11  
Old 05-29-2007
many many thanx.
it will work currectly.
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question