Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Trouble with UNIX tr (translate) function Post 302162927 by Smiling Dragon on Wednesday 30th of January 2008 05:20:40 PM
Old 01-30-2008
Quote:
Originally Posted by by_tg
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...`

 

9 More Discussions You Might Find Interesting

1. OS X (Apple)

Cannot translate Unix executable files

Help!! I loaded OS X Panther on my Mac G4 and found that many files previously saved as txt files were inadventently converted to Unix executable files. When I try to read these in Word, the Word filters cannot recognize or translate the file properly. Does anyone know how to translate these files?... (1 Reply)
Discussion started by: Steven Greenber
1 Replies

2. Shell Programming and Scripting

Trouble using substr function with Bourne shell script

Hi, I'm a newbie to UNIX scripting and I'm having some trouble compiling my script. I'm using the Bourne Shell and cannot seem to use the substr function correctly. I'm trying to extract the last two digits of a year that's stored in a variable based off of a condition. I've searched the... (4 Replies)
Discussion started by: E2004
4 Replies

3. Shell Programming and Scripting

how to achicve translate in unix

hi, i have file with 4 columns, the first column contains 10 numbers. i want to replace t the numbers (u can say i want to use cryptography). i want to replace 1 with 4, 2 with 5, 3 with 9..... how can i achieve this in unix. :confused: (1 Reply)
Discussion started by: javeed7
1 Replies

4. UNIX for Dummies Questions & Answers

Having trouble finding good unix study material

I am trying to read about a UNIX distribution list but I cannot seem to find out what it is or where I can find a website to read more on it any help would be greatly appreciated (2 Replies)
Discussion started by: starshot
2 Replies

5. Homework & Coursework Questions

unix script trouble

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Hi I am new to unix and need some help, the main reason I am here is because i need basic unix knowledge The... (2 Replies)
Discussion started by: krolike
2 Replies

6. Shell Programming and Scripting

!!VERY URGENT!! Trouble in getting user input, while using under CASE statement in UNIX

i want to get user input like this please tell which option to chose 1. mango 2. tango 3. rango if user chooses mango then it should execute a set of statements and again ask like this what do you want to do 1.add 2.subtract 3.exit when i choose exit it should goto my previous... (1 Reply)
Discussion started by: s.deepak
1 Replies

7. Shell Programming and Scripting

Trouble in getting user input while using CASE statement in UNIX

i want to get user input like this please tell which option to chose 1. mango 2. tango 3. rango if user chooses mango then it should execute a set of statements and again ask like this what do you want to do 1.add 2.subtract 3.exit when i choose exit it should goto my previous menu... (4 Replies)
Discussion started by: s.deepak
4 Replies

8. Shell Programming and Scripting

Can someone please help me translate this UNIX script to English?

Hi guys, I'm trying to create a DataStage job and I'm basing it off an existing similar project. The 'Input' value of the job is: (where "/DATA/CSV_FILES" is where all the files were located) My understanding is that for each CSV, it added the 'filename' as Column A. And then it... (5 Replies)
Discussion started by: thedunnyman
5 Replies

9. Shell Programming and Scripting

Trouble Assigning Variable with Function

OSX 10.9 Good morning/afternoon/evening. I'm hoping to get some insight on assigning a variable when calling a function. The code below looks at my array and checks if the path exists. My actual code will have multiple arrays and I would like to define a specific array when I call the... (6 Replies)
Discussion started by: sudo
6 Replies
DtComboBoxAddItem(library call) 										   DtComboBoxAddItem(library call)

NAME
DtComboBoxAddItem -- add an item to the ComboBox widget SYNOPSIS
#include <Dt/ComboBox.h> void DtComboBoxAddItem( Widget w, XmString item, int pos, Boolean unique); DESCRIPTION
Note: This function has been superseded by the equivalent Motif function, XmComboBoxAddItem. Please refer to the Motif Programmer's Refer- ence for more information. The DtComboBoxAddItem function adds the given item to the DtComboBox at the given position. The w argument specifies the DtComboBox widget ID. The item argument specifies the XmString for the new item. The pos argument specifies the position of the new item. The unique argument specifies if this item should duplicate an identical item or not. RETURN VALUE
The DtComboBoxAddItem function returns no value. APPLICATION USAGE
The functions DtComboBoxAddItem and DtComboBoxDeletePos have different naming conventions (Item versus Pos) because of the objects they are manipulating. The Item is a string to be added, the Pos is a numeric position number. SEE ALSO
DtComboBox(3), DtComboBoxDeletePos(3), DtComboBoxSetItem(3), DtComboBoxSelectItem(3). DtComboBoxAddItem(library call)
All times are GMT -4. The time now is 04:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy