9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
For example, if data contains following numbers:1 2 3 4 5 6
I would like get like below using foreach command,1 2
4 5 (1 Reply)
Discussion started by: Ryan Kim
2. Shell Programming and Scripting
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:
set a=(`cat file.txt | grep 'var1' | cut -d... (8 Replies)
Discussion started by: SimonWhite
3. Shell Programming and Scripting
I have a foreach loop in a csh script and I noticed that it tries to find the files with the pattern *$searchpt* in the file name. I'm confused as I never specified checking for the files.
foreach f ( *$searchpt* )
set fnew = `echo $f | awk -v searchpat=$searchpt \
... (1 Reply)
Discussion started by: kristinu
4. Shell Programming and Scripting
im newbie at shell scripting.
why do the following code
setenv CBC ~/cbc/models/
foreach mix (p00p00 p02p00 p02p04)
cp $CBC/*$mix*Gyr*fits $mix/
print(copy) only the first mix?
wasn't it supposed to run through all words... (0 Replies)
Discussion started by: prtc
5. UNIX for Dummies Questions & Answers
OK, so I am extremely rusty and am just getting back to Unix after 9 years.
I'm stuck on something easy. I want to search line-by-line for a string in a file, and I want to do this to a series of files in a directory.
This works fine to do the search:
while read i; do grep $i file2; done... (3 Replies)
Discussion started by: moldoverb
6. Shell Programming and Scripting
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
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
8. Shell Programming and Scripting
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
9. Shell Programming and Scripting
I just want to know how If it's possiple to define 2 variable using foreach command ???
I have directory inside that directory around 1000 file, I want to rename all of this files to something I have it in a list. Example :-
------This is what in my directory----------
d2... (14 Replies)
Discussion started by: geoquest