Direct input to a script from a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Direct input to a script from a file
# 1  
Old 11-16-2010
Direct input to a script from a file

Hi all,

I have a script which checks on my jobs that run on some cluster.
The script, "script.sh", takes as an input the job-id for the job to checked. Sometimes I have 100s of jobs and I want to check them. I could put these job-ids into a file, each id in its own line.
The script would ask me few questions (with a yes or no answers) to see if I want to do some other checks for each job-id.

I want to know how may I direct my job-ids from this file into the script one job-id at a time.

Thanks in advance,

~faizlo
# 2  
Old 11-16-2010
say job_id_file has all job_ids
Code:
#!/bin/ksh
while read job_id
do
      echo "current job id $job_id"
      <DO_YUOR_STUFFS>
done < job_id_file

# 3  
Old 11-16-2010
We don't have k-shell on our machines Smilie
Also, what do you mean <DO YOUR STUFF> do you mean ./script.sh?
I could not find script.sh in your script.

~faizlo
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Disk Space Script to direct output

Hi, I am working on Sun Solaris 5.10 and want to direct the output from a disk space check script to an output file; #!/bin/bash CURRENT=$(df -k /log/logs | grep /log/logs | awk '{ print $5}' | sed 's/%//g') THRESHOLD=30 if ; then echo "Remaining free space is low" > output.txt else... (10 Replies)
Discussion started by: SSKAAB
10 Replies

2. Shell Programming and Scripting

File not exist in direct

friends can do this from unix AIX I need to ask for a file that does not exist then if file.txt * **** echo "execute procedure" else *** echo "File does not exist" if You can sucedere that the file does not exist (2 Replies)
Discussion started by: tricampeon81
2 Replies

3. Shell Programming and Scripting

Manipulating sed Direct Input to Direct Output

Hi guys, been scratching round the forums and my mountain of resources. Maybe I havn't read deep enough My question is not how sed edits a stream and outputs it to a file, rather something like this below: I have a .txt with some text in it :rolleyes: abc:123:xyz 123:abc:987... (7 Replies)
Discussion started by: the0nion
7 Replies

4. Shell Programming and Scripting

Connect direct script for unix

I want to connect direct a xml file and a excel file each separately from unix system to another unix system.The size of the xml file and excel file may vary each time. Below is the possible connect direct script to transfer the files.Please check if it is correct? Also does DCB parameter... (4 Replies)
Discussion started by: bk_12345
4 Replies

5. Shell Programming and Scripting

Script to delete files with an input for directories and an input for path/file

Hello, I'm trying to figure out how best to approach this script, and I have very little experience, so I could use all the help I can get. :wall: I regularly need to delete files from many directories. A file with the same name may exist any number of times in different subdirectories.... (3 Replies)
Discussion started by: *ShadowCat*
3 Replies

6. UNIX for Dummies Questions & Answers

re-direct to log file

#!/bin/ksh -x cd /tmp/tj ftp -n servername.com << DONE user username password as put test.log quit close DONE echo "testing..." sh -x scriptname, and it shows all, but username, as, put, quit, close, DONE. how can i see those ? (1 Reply)
Discussion started by: tjmannonline
1 Replies

7. Shell Programming and Scripting

Need script to take input from file, match on it in file 2 and input data

All, I am trying to figure out a script to run in windows that will allow me to match on First column in file1 to 8th Column in File2 then Insert file1 column2 to file2 column4 then create a new file. File1: 12345 Sam 12346 Bob 12347 Bill File2:... (1 Reply)
Discussion started by: darkoth
1 Replies

8. Shell Programming and Scripting

how to direct scp output to a file in bash shell or script

I can run this from the command line: scp -i identfile /path/file_to_send remotelogin@remotebox:/path_to_put_it/file_to_send and I get: file_to_send 100% |***************************************************************************| 0 00:00 but if I do: scp -i identfile... (6 Replies)
Discussion started by: NewSolarisAdmin
6 Replies

9. Shell Programming and Scripting

Direct the output of a script to a log file

Hi, I have a script to compare 2 files. file1=$1 file2=$2 num_of_records_file1=`awk ' END { print NR } ' $file1` num_of_records_file2=`awk ' END { print NR } ' $file2` i=1 while do sed -n "$i"p $file1 > file1_temp sed -n "$i"p $file2 > file2_temp diff file1_temp... (5 Replies)
Discussion started by: autosys_nm
5 Replies

10. Shell Programming and Scripting

How to direct a script to a new web page after a script got completed?

Hi , I have a cgi code with shell script on it.I am submitting a form in the first.cgi.These values are posted to second.cgi.Second.cgi do some process with these values. After that i want to direct my page from second.cgi to first.cgi. What is the command i can use from cgi(shell) script? ... (2 Replies)
Discussion started by: rajbal
2 Replies
Login or Register to Ask a Question