![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problem in awk command | viveksnv | Shell Programming and Scripting | 3 | 03-03-2008 01:59 AM |
| problem with tr command | ravi raj kumar | UNIX for Advanced & Expert Users | 2 | 07-02-2007 03:41 AM |
| problem with dd command or maybe AFS problem | Anta | Shell Programming and Scripting | 0 | 08-25-2006 07:10 AM |
| ls command problem | buckhtr77 | SUN Solaris | 2 | 12-06-2005 01:16 PM |
| Problem while using Sed command | gopskrish | UNIX for Dummies Questions & Answers | 2 | 06-27-2005 08:26 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Problem with tr command a-z 0-9
Hi experts,
I am getting a strange result when using the tr command. I am using tr to change file names extensions created by split command ( from aa, ab, ac etc to 00, 01, 02 etc). If I run the script from command prompt I get the expected results but when I do it thru a cron tab and invoked from a perl scriipt i get strange results. For example ab gets converted to 08 but aa gets converted to 00. + old_ext=ae + print Old Extension ae Old Extension ae + + tr a-z 0-9 + echo ae new_ext=0e + print New Extension 0e New Extension 0e for ab new_ext is coming as 08 from there onwards it is 0c, 0d,0e like that. Here is the relevant portion of the code. for i in `ls ${base_file_name}.a*` old_ext=${i##*.} print "Old Extension " $old_ext new_ext=`echo $old_ext | tr 'a-z' '0-9'` print "New Extension " $new_ext done any help would be highly appreciated as I spent many hours on this. I tried severl approaches like putting eval in front of echo but couldn't get this working. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
tr a-z
I could solve the problem now. Instead of using 'a-z' I used 'abcdefghijk..'
That's all. I am using aix and shell is ksh |
|||
| Google The UNIX and Linux Forums |