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 Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to achicve translate in unix javeed7 Shell Programming and Scripting 1 03-31-2008 11:05 AM
Trouble using substr function with Bourne shell script E2004 Shell Programming and Scripting 4 09-29-2005 10:57 AM
Can someone help translate this snippet? Heron Shell Programming and Scripting 7 03-29-2005 02:01 AM
Cannot translate Unix executable files Steven Greenber OS X (Apple) 1 02-11-2004 03:14 PM
translate text (1 position) with sed peterk Shell Programming and Scripting 5 12-12-2003 05:31 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 01-30-2008
by_tg by_tg is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 4
Trouble with UNIX tr (translate) function

UNIX script - problem.

I want the spaces in my Item variable to be replaced with a question mark. Can you tell me what I am doing wrong? This is the whole code line.

Item | tr -s " " "?"

Why is this not making any changes to the Item value?

Thanks for any help you can give!
tg
  #2 (permalink)  
Old 01-30-2008
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
  
 

Join Date: Nov 2007
Location: New Zealand
Posts: 921
Quote:
Originally Posted by by_tg View Post
UNIX script - problem.

I want the spaces in my Item variable to be replaced with a question mark. Can you tell me what I am doing wrong? This is the whole code line.

Item | tr -s " " "?"

Why is this not making any changes to the Item value?

Thanks for any help you can give!
tg
If $item is your variable, you would need to echo it and store it back into the variable again.
Eg:
Code:
item=`echo $item | tr...`
  #3 (permalink)  
Old 01-30-2008
bobbygsk bobbygsk is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 90
Try the following command

Quote:
echo "i te m" | tr -s " " "?"
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 04:36 AM.


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