10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am working on converting shell to Perl script. In shell we have built in function
trap
Do you know alternative in Perl or actually we don't need it?
Thanks for contribution (3 Replies)
Discussion started by: digioleg54
3 Replies
2. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Hi,
The problem statement is: I am trying to read line by line from a flat file by using a while loop. The... (9 Replies)
Discussion started by: Sandeep Pattnai
9 Replies
3. UNIX for Dummies Questions & Answers
I am writing a shell script to uncompress files in a directory, then call a Perl script to search the files for given terms, store those terms in a different output file , and compress the output. I get a syntax error with my use of foreach. Below is my script.
#!/bin/csh -fxv
if (!... (2 Replies)
Discussion started by: dgrayman
2 Replies
4. 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
5. Shell Programming and Scripting
Hi there,
I need some help with a shell script (I'm no sh script expert, but I hope this will explain how I want my script):dir = /home/user/files/
foreach(*.jpg file in $dir) {
tar -cf $file(-.jpg).tar $file;gzip $file(-.jpg).tar
}
mv -f $dir*tar.gz /home/user/pictures/
Thanks for any... (12 Replies)
Discussion started by: JKMlol
12 Replies
6. UNIX for Dummies Questions & Answers
Hi
I would like foreach to go through a range of numbers 1-365. This input is being read by a compiled fortran program in the same shell script. Let me try an example to clarify
#!/bin/sh
foreach i (1-365)
./data_make program <<EOF
'echo $i'
/data_'echo $i' #output file
I... (10 Replies)
Discussion started by: d_kowalske
10 Replies
7. Shell Programming and Scripting
I am scripting in tcsh and here is what I currently have:
foreach group (g1 g2 g3 g4)
set ppl = `cat $group.file.with.list.of.ppl.in.row.format`
set label = 1
@ label += 1
foreach ppls ($ppl)
echo $label >> file
end
end
... (0 Replies)
Discussion started by: bonesy
0 Replies
8. Shell Programming and Scripting
Hi All,
I am facing 'No Match' problem with foreach loop in C shell script.
Initially I tried following grep command showing results properly as shown at the end of the Thread. But foreach command is throwing the error 'No match'.
grep -n Inserted audit_file
foreach insertstr (`grep -n... (0 Replies)
Discussion started by: adurga
0 Replies
9. Shell Programming and Scripting
Hi all
Is there any way I could set "locale" variables other than writing a C-program using the "setlocale" function? IŽd like to be able to set it from a shell script.
Cheers (3 Replies)
Discussion started by: Indalecio
3 Replies
10. UNIX for Dummies Questions & Answers
I need to read list of machines from a file using foreach loop.
I am trying the follwing, but its not reading the list
foreach i (`cat file.lst | awk '{print $1}'`)
ls -l | grep $i
end
here the file file.lst contains list of files
Any idea whats wrong here
Thanks
Krisyet (2 Replies)
Discussion started by: krisyet
2 Replies