Why do you have a while loop inside your while loop, though? The 'while read' loop will eat all your lines. By the time the second loop happens, they will be all gone.
If you want to read the same file repeatedly, redirect your file into the inner loop, not the outer one.
I know the Sun Solaries versions are ( 2.3 , 2.4 , 2.5 ... 7 , 8 ) .
But some times I see sun os v5.x what does it mean ??
also what is the last new machine for sun and what are its details specifications .
Thanks (3 Replies)
Hello Again,
Ok guys. Thanks again for your help last time but I am in need of your experience again. I wrote this script:
#!/bin/sh
# List either files or directories in individual accounts
# using 1, 2 or 3 with invalid
case $1 in
echo select 1 to see the FILES in your... (3 Replies)
this is the simple question, please help me!
the question is: how to send exactly 50 ICMP Echo request packets with 500 bytes of payload to 202.139.129.221?
I tried to use ping -F 500 202.139.129.221, but it didn't work.
Thanks! (6 Replies)
Ive got some output in a file that looks exactly like this:
1
-----------
1542
1 record(s) selected.
How do I just extract that 1542 and drop it into another file or (preferrably) a variable (using a ksh script) (9 Replies)
I have a file name in this format
ABC_WIRE_TRANS_YYYYMMDD_00.DAT
I need to cut out the _00 out of the file name everytime. It could be _00, _01,_02, etc ....
How do I cut it out to look as follows?
ABC_WIRE_TRANS_YYYYMMDD.DAT (6 Replies)
Hi everybody:
Could anybody tell me if I have several files which each one it has this pattern name:
name1.dat name2.dat name3.dat name4.dat name10.dat name11.dat name30.dat
If I would like create one like:
name_total.dat
If I do:
paste name*.dat > name_total.dat (15 Replies)
I have a file called mytitles.txt containing a list of book titles
I have a second file called abfile.txt containing a list of book titles (in the 3rd field) and it has author info and copyright year info as well..
I want to search mytitles.txt for a match in the 3rd field of abfiles.txt, and... (2 Replies)
Hi Guru's.
I am trying to use to check if $5 is greater than 80 & if not 100, then to print $0 :
awk '{ if ($5>80) && if ($5 != 100) print $0}
But getting error:
>bdf1|sed 's/%//g'|awk '{ if ($5>80) && if ($5 != 100) print $0}'
syntax error The source line is 1.
The error... (6 Replies)
Discussion started by: rveri
6 Replies
LEARN ABOUT REDHAT
foreach
foreach(n) Tcl Built-In Commands foreach(n)
__________________________________________________________________________________________________________________________________________________NAME
foreach - Iterate over all elements in one or more lists
SYNOPSIS
foreach varname list body
foreach varlist1 list1 ?varlist2 list2 ...? body
_________________________________________________________________DESCRIPTION
The foreach command implements a loop where the loop variable(s) take on values from one or more lists. In the simplest case there is one
loop variable, varname, and one list, list, that is a list of values to assign to varname. The body argument is a Tcl script. For each
element of list (in order from first to last), foreach assigns the contents of the element to varname as if the lindex command had been
used to extract the element, then calls the Tcl interpreter to execute body.
In the general case there can be more than one value list (e.g., list1 and list2), and each value list can be associated with a list of
loop variables (e.g., varlist1 and varlist2). During each iteration of the loop the variables of each varlist are assigned consecutive
values from the corresponding list. Values in each list are used in order from first to last, and each value is used exactly once. The
total number of loop iterations is large enough to use up all the values from all the value lists. If a value list does not contain enough
elements for each of its loop variables in each iteration, empty values are used for the missing elements.
The break and continue statements may be invoked inside body, with the same effect as in the for command. Foreach returns an empty string.
EXAMPLES
The following loop uses i and j as loop variables to iterate over pairs of elements of a single list. set x {} foreach {i j} {a b c d e f}
{
lappend x $j $i } # The value of x is "b a d c f e" # There are 3 iterations of the loop.
The next loop uses i and j to iterate over two lists in parallel. set x {} foreach i {a b c} j {d e f g} {
lappend x $i $j } # The value of x is "a d b e c f {} g" # There are 4 iterations of the loop.
The two forms are combined in the following example. set x {} foreach i {a b c} {j k} {d e f g} {
lappend x $i $j $k } # The value of x is "a d e b f g c {} {}" # There are 3 iterations of the loop.
SEE ALSO
for(n), while(n), break(n), continue(n)
KEYWORDS
foreach, iteration, list, looping
Tcl foreach(n)