Sponsored Content
Top Forums Programming tcl-getting the index of a certain value of a list Post 302499511 by pflynn on Thursday 24th of February 2011 01:48:08 PM
Old 02-24-2011
You are looking for something like the lsearch command:

% set foo[list 1 2 3 4 5]
1 2 3 4
% lsearch $foo 4
3

# the -integer option is reasonable here, since we are searching into a list of integers:
% lsearch -integer $foo 4
3


Tcl Built-In Commands - lsearch manual page
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

What is index?

hi, :) In a shell script i came accross the following lines 1.for i in ` find /home/oracle -name ch' 2.do 3.echo $i 4.idx=`expr index $i .` 5.done Here iam not able to understand the porpose of the word "index" in line 4. any help ? cheers RRK (3 Replies)
Discussion started by: ravi raj kumar
3 Replies

2. Filesystems, Disks and Memory

why the inode index of file system starts from 1 unlike array index(0)

why do inode indices starts from 1 unlike array indexes which starts from 0 its a question from "the design of unix operating system" of maurice j bach id be glad if i get to know the answer quickly :) (0 Replies)
Discussion started by: sairamdevotee
0 Replies

3. UNIX for Dummies Questions & Answers

wh inode index starts from 1 unlike array index (0)

brothers why inode index starts from 1 unlike array inex which starts from 0 its a question from the design of unix operating system of maurice j.bach i need to know the answer urgently...someone help please (1 Reply)
Discussion started by: sairamdevotee
1 Replies

4. Shell Programming and Scripting

Sort from start index and end index in line

Hi All, I have a file (FileNames.txt) which contains the following data in it. $ cat FileNames.txt MYFILE17XXX208Sep191307.csv MYFILE19XXX208Sep192124.csv MYFILE20XXX208Sep192418.csv MYFILE22XXX208Sep193234.csv MYFILE21XXX208Sep193018.csv MYFILE24XXX208Sep194053.csv... (5 Replies)
Discussion started by: krish_indus
5 Replies

5. UNIX for Dummies Questions & Answers

string index

I have a line "My name is Deepak" How can i search a string Deepak in the line and find out its index position. Here in this case the result should be 12. (3 Replies)
Discussion started by: dr46014
3 Replies

6. UNIX for Dummies Questions & Answers

I'm unable to run Keyed List commands(in ubuntu's terminal and Evolane Tcl Engine)

I'm trying to run these commands (keylset,keylget) but i keep getting a error message "invalid command name "keylset"". I've tried running it on both ubuntu's terminal and also Evolane Tcl Engine. Any idea what could be the problem? (1 Reply)
Discussion started by: abe171
1 Replies

7. Shell Programming and Scripting

Get index value by awk

HI All, I would like to pass a integer and get all values under this index the by using awk. Could anyone help? Thanks :> input: 1,2,3,4,5,6,7 1,2,3,48,5,6,7 1,2,3,4,5,6,7 e.g. i pass 4 to awk command output: 4 48 4 Video tutorial on how to use code tags in The UNIX and Linux... (8 Replies)
Discussion started by: mimilaw
8 Replies

8. UNIX and Linux Applications

Index server

Hi guys, I have postgresql server with huge amount of data, nearly 2 billion records. each record is at most 50 bytes(4 integer fields). I need to build index on all column to do fast reporting. but indexes becomes bloat after some time. almost 80% of database size is because of its huge... (0 Replies)
Discussion started by: majid.merkava
0 Replies

9. Shell Programming and Scripting

Need Help in Index

I am having data in XML format and trying to extract codes form two fields called <String>, below is the data. <Node>tollfree<Condition>BooleanOperator<Operation>AND</Operation><Condition>BooleanOperator<Operation>NOT</Operation><Condition>FieldSelection<Field Context="ALL fields"... (7 Replies)
Discussion started by: rramkrishnas
7 Replies

10. UNIX for Beginners Questions & Answers

TCL script to extract the file name and then create two independent list

I am having one problem as stated below Problem Description I am having some "sv" extension files , I am using "glob" to extract the matching files , Now in these matching files , I need to split them and extract the elements and create different lists. For example set files This... (1 Reply)
Discussion started by: kshitij
1 Replies
d_list_proc(3alleg4)						  Allegro manual					      d_list_proc(3alleg4)

NAME
d_list_proc - Dialog procedure implementing a list box object. Allegro game programming library. SYNOPSIS
#include <allegro.h> int d_list_proc(int msg, DIALOG *d, int c); DESCRIPTION
A list box object. This will allow the user to scroll through a list of items and to select one by clicking or with the arrow keys. If the D_EXIT flag is set, double clicking on a list item will close the dialog. The index of the selected item is held in the d1 field, and d2 is used to store how far it has scrolled through the list. The dp field points to a function which will be called to obtain information about the contents of the list. This should follow the form: char *foobar(int index, int *list_size); If index is zero or positive, the function should return a pointer to the string which is to be displayed at position index in the list. If index is negative, it should return NULL and list_size should be set to the number of items in the list. To create a multiple selection listbox, set the dp2 field to an array of byte flags indicating the selection state of each list item (non- zero for selected entries). This table must be at least as big as the number of objects in the list! SEE ALSO
exgui(3alleg4) Allegro version 4.4.2 d_list_proc(3alleg4)
All times are GMT -4. The time now is 01:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy