![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problem in awk command | viveksnv | Shell Programming and Scripting | 3 | 03-03-2008 04:59 AM |
| problem with tr command | ravi raj kumar | UNIX for Advanced & Expert Users | 2 | 07-02-2007 06:41 AM |
| problem with dd command or maybe AFS problem | Anta | Shell Programming and Scripting | 0 | 08-25-2006 10:10 AM |
| ls command problem | buckhtr77 | SUN Solaris | 2 | 12-06-2005 04:16 PM |
| Problem while using Sed command | gopskrish | UNIX for Dummies Questions & Answers | 2 | 06-27-2005 11:26 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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. |
|
||||
|
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 |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|