The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-12-2008
kodermanna kodermanna is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 11
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.
  #2 (permalink)  
Old 04-12-2008
kodermanna kodermanna is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 11
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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 05:56 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0