llength(n) Tcl Built-In Commands llength(n)
__________________________________________________________________________________________________________________________________________________NAME
llength - Count the number of elements in a list
SYNOPSIS
llength list
_________________________________________________________________DESCRIPTION
Treats list as a list and returns a decimal string giving the number of elements in it.
EXAMPLES
The result is the number of elements:
% llength {a b c d e}
5
% llength {a b c}
3
% llength {}
0
Elements are not guaranteed to be exactly words in a dictionary sense of course, especially when quoting is used:
% llength {a b {c d} e}
4
% llength {a b { } c d e}
6
An empty list is not necessarily an empty string:
% set var { }; puts "[string length $var],[llength $var]"
1,0
SEE ALSO
list(n), lappend(n), lindex(n), linsert(n), lsearch(n), lset(n), lsort(n), lrange(n), lreplace(n)
KEYWORDS
element, list, length
Tcl llength(n)
Check Out this Related Man Page
lrange(1T) Tcl Built-In Commands lrange(1T)__________________________________________________________________________________________________________________________________________________NAME
lrange - Return one or more adjacent elements from a list
SYNOPSIS
lrange list first last
_________________________________________________________________DESCRIPTION
List must be a valid Tcl list. This command will return a new list consisting of elements first through last, inclusive. First or last
may be end (or any abbreviation of it) to refer to the last element of the list. If first is less than zero, it is treated as if it were
zero. If last is greater than or equal to the number of elements in the list, then it is treated as if it were end. If first is greater
than last then an empty string is returned. Note: ``lrange list first first'' does not always produce the same result as ``lindex list
first'' (although it often does for simple fields that aren't enclosed in braces); it does, however, produce exactly the same results as
``list [lindex list first]''
EXAMPLES
Selecting the first two elements:
% lrange {a b c d e} 0 1
a b
Selecting the last three elements:
% lrange {a b c d e} end-2 end
c d e
Selecting everything except the first and last element:
% lrange {a b c d e} 1 end-1
b c d
Selecting a single element with lrange is not the same as doing so with lindex:
% set var {some {elements to} select}
some {elements to} select
% lindex $var 1
elements to
% lrange $var 1 1
{elements to}
SEE ALSO list(1T), lappend(1T), lindex(1T), linsert(1T), llength(1T), lsearch(1T), lset(1T), lreplace(1T), lsort(1T) |
KEYWORDS
element, list, range, sublist
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+--------------------+-----------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+--------------------+-----------------+
|Availability | SUNWTcl |
+--------------------+-----------------+
|Interface Stability | Uncommitted |
+--------------------+-----------------+
NOTES
Source for Tcl is available on http://opensolaris.org.
Tcl 7.4 lrange(1T)
Hi,
I am new to tcl programming, i want to know how to write a procedure for list operations taking the user input from command line and outputs the the index of each element in the list.
Eg:
input list is : { 1 2 {ab cde} {acf t12 l34} 3 5{43 {try 5 }} } something like this.
output should... (6 Replies)
I would like to create an array using tcl script which takes in name, id, and marks of many people in 3 subjects.
I would like calculate the total marks of each person and rank them according to their marks.
Taking name as my key for access i want to do sort and rank the person based on highest... (3 Replies)
Hi All,
I am new to unix but have a requirement wherein I need to separate datatype,length, and column name from input file which is of below format --
record
integer(10) empid;
string(25) name;
date("YYYY-MM-DD") dob;
decimal(10) salary;
end
now after getting datatype,its length and... (4 Replies)
I'm using the following script to check cisco router health and I'd like to save output to a file,
vty_runcmd.sh > /check/check-cisco-health
script works and output is saved to a file. However using it in crontab file is created but output is not printed inside it. In crontab,
*/5 * * * *... (4 Replies)
hii,,
I am trying to automate jira. during my scripting using bash script, in the terminal i got the terminal message like this:
"Configure which ports JIRA will use.
JIRA requires two TCP ports that are not being used by any other
applications on this machine. The HTTP port is where you... (1 Reply)
Hi All,
I have a string
re_em="NODE_NAME=ABCDEF;NODE_TYPE=ghijkl;CIRCLE=jkl;Serving_Circle=abcdefghthjk;DOMAIN_TYPE=1234;REGION=12345;ZONE=12334;SOURCE_TYPE=dhfkdkfjdjf"
I want to split this string and convert it into array so that i can easily access any value like NODE_NAME or... (2 Replies)
Hi unix Gurus,
I am really new to Unix Scripting. Please help me to create a shell script which reads the xml file and from that i need to fetch a particular information.
For example
<SOURCE BUSINESSNAME ="" DATABASETYPE ="Teradata" DBDNAME ="DWPROD3" DESCRIPTION ="" NAME... (5 Replies)
Hey all. I'm writing a script to automatically login to a router, change directories to where crashfiles are located, then listing all files in that directory. This is where I'm at so far and wish to have some user interaction to choose the files.
What I am trying to do is list the files and get... (1 Reply)
The big problem is that exp_internal isnt working... which makes it difficult to determine whats happening with the if statement.
1. why isnt exp_internal not working ?
2. Is there a better way to do the check of a file ?
Im trying to find a "tighter" way to check that a file exists and has... (0 Replies)
Hi,
I'm a new user of this forum and I'm not an expert of linux.
I have a broken old pc with red hat linux, I clone hdd to another pc with different mainboard and it's ok but it has only one problem, the usb ports not work.
In the boot this message appears:
... (9 Replies)
Hi All,
I want to copy /.ssh/OM.pub file from source to destination.
Here source IP address, username and password is always fixed.
Whereas destination server IP address, password always gets changed.
From destination server :-
I am trying to write a script in which it should log in to... (3 Replies)
Hello,
I'm doing a simple script with expect (a telnet which works without user/pass), and I want to put a condition if timeout happens, then to print a message, but it doesn't work. The script looks like below:
#!/usr/bin/expect
log_user 0
set timeout 10
spawn telnet IP PORT
send... (3 Replies)
Hello,
I'm facing some problems with a barcode scanner from Cygnal Inc, model Sweda SL-20. Info from lsusb -v:
Bus 003 Device 003: ID 10c4:ff11 Cygnal Integrated Products, Inc.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
... (4 Replies)
Hi,
I am executing a expect script in while loop for doing telnet on list of servers stored in file as below :
expect script :
#!/usr/bin/expect -f
set timeout 20
set ip
set port
if { == 0} {
send_user "Usage: scriptname ip port\n"
exit 1
}
#exp_internal 1
log_user 0
spawn... (3 Replies)
I have someone wanting to connect to the serial management port of a switch from a PC running CentOS6. The management port on the switch is apparently baud 9600, 8 data bits, 1 stop bit & no parity They have plugged in a cable to connect and the output from lsusb is:-Bus 001 Device 001: ID... (7 Replies)