9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I found that this foreach should work with two lists (source: Wikipedia.org)
foreach i {1 2 3} j {a b c} { puts "$i $j"}
==
I try smth. like:
With two text files:
first.part
second.part
foreach first (`cat first.part`) second (`cat second.part`)
toolcommand $first... (22 Replies)
Discussion started by: unknown7
22 Replies
2. Shell Programming and Scripting
Hi everybody,
I'm trying to use a foreach command with two lists. The file.txt looks like this:
var1: 100 200 300
var2: 3 6 9
I'm trying to use a foreach command to associate the two variables together. My script looks like this:
#! /bin/tcsh
set a=(`cat file.txt | grep 'var1' | cut -d... (8 Replies)
Discussion started by: SimonWhite
8 Replies
3. Shell Programming and Scripting
Can any one please help I am trying to sort each item in every line and count the common (non case sensitive) and at the end printing all the unique alphabetically.
Here is what i did ... I can print all the lines but struck to sort each line some were:
I am getting the output as:
I... (5 Replies)
Discussion started by: sureshcisco
5 Replies
4. Shell Programming and Scripting
im newbie at shell scripting.
why do the following code
#!/bin/tcsh
setenv CBC ~/cbc/models/
foreach mix (p00p00 p02p00 p02p04)
echo $mix
cp $CBC/*$mix*Gyr*fits $mix/
end
print(copy) only the first mix?
% ./copyfromcbc.sh
p00p00
wasn't it supposed to run through all words... (0 Replies)
Discussion started by: prtc
0 Replies
5. Shell Programming and Scripting
Hi everyone
Does anyone know what is wrong with this script. i keep getting errors
foreach filename (`cat testing1`)
set string=$filename
set depth=`echo "$string"
echo $depth
end
the error is the following
testing: line 1: syntax error near unexpected token `('
testing: line 1:... (3 Replies)
Discussion started by: ROOZ
3 Replies
6. Shell Programming and Scripting
Hi Guys,
I have a loop which uses a wildcard
i.e. foreach f (*)
but when I execute the tcsh file in unix then it gives me an error
->>>>>>>foreach: words not parenthesized<<<<<<<<<<-
Any help. (1 Reply)
Discussion started by: abch624
1 Replies
7. Shell Programming and Scripting
What am I doing wrong with this foreach loop?
foreach var ($argv)
@sum = $sum + $var (4 Replies)
Discussion started by: haze21
4 Replies
8. Shell Programming and Scripting
Hi,
I'm having a small issue here and I can't get it to work. I'm programming a script for bash and I need to do something to all the folder in a directory. So I'm in the directory and I want to use the foreach statement but I dont know how to reference all the folders of that directory. To make... (7 Replies)
Discussion started by: eltinator
7 Replies
9. Shell Programming and Scripting
#!/bin/bash
foreach x (67402996 67402998)
{
grep -a x FINAL2006.dat >> MISSING_RECORDS.dat
}
I'm trying to pass a list to the variable x, and then grep for that string in FINAL2006.dat...
Final2006.dat is in the same folder as my .sh file. I call this with a .cmd file...
At any rate,... (6 Replies)
Discussion started by: JimWork
6 Replies