Sponsored Content
Full Discussion: define length of variable
Top Forums UNIX for Dummies Questions & Answers define length of variable Post 68157 by Perderabo on Thursday 31st of March 2005 03:29:48 PM
Old 03-31-2005
What happens in the year 2010? Smilie
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Using Grep to Define a Variable

I am using korn shell unix. I have a script that I am working with to do a check for me using a text file. #finds "Time" from the text file and cuts the second field from the #line A= grep Time test.txt | cut -f2 # the "#Missing" is being pulled from the second field of the text... (1 Reply)
Discussion started by: cspcspcsp
1 Replies

2. Shell Programming and Scripting

creating a fixed length output from a variable length input

Is there a command that sets a variable length? I have a input of a variable length field but my output for that field needs to be set to 32 char. Is there such a command? I am on a sun box running ksh Thanks (2 Replies)
Discussion started by: r1500
2 Replies

3. Shell Programming and Scripting

Make variable length record a fixed length

Very, very new to unix scripting and have a unique situation. I have a file of records that contain 3 records types: (H)eader Records (D)etail Records (T)railer Records The Detail records are 82 bytes in length which is perfect. The Header and Trailer records sometimes are 82 bytes in... (3 Replies)
Discussion started by: jclanc8
3 Replies

4. Shell Programming and Scripting

How to define a variable with variable definition is stored in a variable?

Hi all, I have a variable say var1 (output from somewhere, which I can't change)which store something like this: echo $var1 name=fred age=25 address="123 abc" password=pass1234 how can I make the variable $name, $age, $address and $password contain the info? I mean do this in a... (1 Reply)
Discussion started by: freddy1228
1 Replies

5. Shell Programming and Scripting

bash - define a variable

Hello, I would like to define a variable based on another variable: a=5 b$a=100 This does not work. What is the right way to do it? Thanks ---------- Post updated at 07:37 PM ---------- Previous update was at 07:33 PM ---------- Found my answer with the search function (did not... (0 Replies)
Discussion started by: jolecanard
0 Replies

6. Shell Programming and Scripting

changing a variable length text to a fixed length

Hi, Can anyone help with a effective solution ? I need to change a variable length text field (between 1 - 18 characters) to a fixed length text of 18 characters with the unused portion, at the end, filled with spaces. The text field is actually field 10 of a .csv file however I could cut... (7 Replies)
Discussion started by: dc18
7 Replies

7. Shell Programming and Scripting

question about define variable.

Hi, Unix Gurus, In our existing file, there is a script like #!/bin/sh step=${1:-0} cur_step=10 if ... My question is what's "${1:-0}" mean? I know it defines a variable but I don't know what's (1:-0) mean? :wall: Thanks in advance. (2 Replies)
Discussion started by: ken002
2 Replies

8. Shell Programming and Scripting

Define variable from file.

HI I have file A.txt _1A _2A _3A _4A I want define all as different variable. $1A=_1A $2B=_2A $3C=_3A $4D=_4A Now i can use any variable in my script. (3 Replies)
Discussion started by: pareshkp
3 Replies

9. Shell Programming and Scripting

Convert variable length record to fixed length

Hi Team, I have an issue to split the file which is having special chracter(German Char) using awk command. I have a different length records in a file. I am separating the files based on the length using awk command. The command is working fine if the record is not having any... (7 Replies)
Discussion started by: Anthuvan
7 Replies
set(n)							       Tcl Built-In Commands							    set(n)

__________________________________________________________________________________________________________________________________________________

NAME
set - Read and write variables SYNOPSIS
set varName ?value? _________________________________________________________________ DESCRIPTION
Returns the value of variable varName. If value is specified, then set the value of varName to value, creating a new variable if one does not already exist, and return its value. If varName contains an open parenthesis and ends with a close parenthesis, then it refers to an array element: the characters before the first open parenthesis are the name of the array, and the characters between the parentheses are the index within the array. Otherwise varName refers to a scalar variable. If varName includes namespace qualifiers (in the array name if it refers to an array element), or if varName is unqualified (does not include the names of any containing namespaces) but no procedure is active, varName refers to a namespace variable resolved according to the rules described under NAME RESOLUTION in the namespace manual page. If a procedure is active and varName is unqualified, then varName refers to a parameter or local variable of the procedure, unless varName was declared to resolve differently through one of the global, variable or upvar commands. EXAMPLES
Store a random number in the variable r: set r [expr {rand()}] Store a short message in an array element: set anAry(msg) "Hello, World!" Store a short message in an array element specified by a variable: set elemName "msg" set anAry($elemName) "Hello, World!" Copy a value into the variable out from a variable whose name is stored in the vbl (note that it is often easier to use arrays in practice instead of doing double-dereferencing): set in0 "small random" set in1 "large random" set vbl in[expr {rand() >= 0.5}] set out [set $vbl] SEE ALSO
expr(n), global(n), namespace(n), proc(n), trace(n), unset(n), upvar(n), variable(n) KEYWORDS
read, write, variable Tcl set(n)
All times are GMT -4. The time now is 05:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy