Need help to run query in loop for all acct nbr in a file..


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need help to run query in loop for all acct nbr in a file..
# 1  
Old 09-21-2011
Need help to run query in loop for all acct nbr in a file..

I have a txt file with contents of acct nbr's like:

22222222222
33333333333
33445566778

I need to write a script which takes each acct nbr in the file and run the query like:

select seq_nbr from event where acct_nbr='22222222222'


and the query's output should be passed to a process like

MoveFile <seq_nbr>




The same should be done for all the acct nbr's in the file..
Can any one please guide me Smilie

Moderator's Comments:
Mod Comment Double post, continued here

Last edited by pludi; 09-21-2011 at 07:28 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to write MySQL query in text file and run in Linux?

I would like to call a .sql file from a .sh file in linux. The .sql file will contain queries to MySQL database. I am able to call the .sql file by running .sh file in linux, but the sql query is not working. Below is my syntax. The select statement is throwing below error. ./sample.sql: line... (1 Reply)
Discussion started by: qytan
1 Replies

2. Shell Programming and Scripting

Run a loop that will search for a file to thousand machine and know who owns the file

Run a loop that will search for a file to thousand machine and know who owns the file $ for i in abc{01..02} > do > echo -n $i > ssh $i "sudo find / -name .ssh -exec ls -l {} \;|grep id" > done abc01-rw-------. 1 root root 1675 Nov 10 2018 id_rsa abc01-rw-------. 1 root root 1675 Nov 14... (6 Replies)
Discussion started by: invinzin21
6 Replies

3. Shell Programming and Scripting

Get vaule and from file and need to run in loop

Hi All, I have a command which provide this output symaccess -sid 624 show PG_E36_PG6P -type port |grep FA FA-5G:1 FA-6G:0 FA-11G:0 FA-12G:1 I need to use the value in loop like this (5 Replies)
Discussion started by: ranjancom2000
5 Replies

4. Shell Programming and Scripting

How to run a remote database query?

Thank you for taking the time to read my issue. I need to set up a script to run from a wagon wheel type toplogy where 1 server needs to query about 10 to 15 remote servers for duplicate values in a database table. If a duplicate value is found, send an email to me( or wall command to console).... (5 Replies)
Discussion started by: lutador72
5 Replies

5. Shell Programming and Scripting

Run SQL thru shell script: how to get a new line when run sql query?

Hi, this's Pom. I'm quite a new one for shell script but I have to do sql on shell script to query some information from database. I found a concern to get a new line...When I run my script, it retrieves all data as wondering but it's shown in one line :( What should I do? I'm not sure that... (2 Replies)
Discussion started by: Kapom
2 Replies

6. Shell Programming and Scripting

Run script to export the data to ixf file in loop

Hi, I am trying to export the data to an .ixf file. I have read the table names from a .dat file and those table name should be passed to the select * from schema.TABLENAME query . I am trying the below loop while read TABLE; do db2 EXPORT TO ~/data_export/$TABLE.ixf OF IXF MESSAGES... (5 Replies)
Discussion started by: vikyalex4
5 Replies

7. Shell Programming and Scripting

Need help to run query in loop for all acct nbr in a file..

I have a txt file with contents of acct nbr's like: 22222222222 33333333333 33445566778 I need to write a script which takes each acct nbr in the file and run the query like: select seq_nbr from event where acct_nbr='22222222222' and the query's output should be passed to a... (2 Replies)
Discussion started by: Rajesh Putnala
2 Replies

8. Shell Programming and Scripting

Need help to run sql query from a script..which takes input from a file

I need to run sql script from shell script which takes the input from a file and contents of file will be like : 12345 34567 78657 and query will be like : select seq_nbr from bus_event where event_nbr='12345'; select seq_nbr from bus_event where event_nbr='34567'; select seq_nbr... (1 Reply)
Discussion started by: rkrish
1 Replies

9. Shell Programming and Scripting

Need help in writing a script that do internal grep on a log file..and extract acct no's from it..

I need to write a script, which takes the input a log file and create output file with acct no's line by line from selected records with text like (in red) : 18:51:18 | 217863|Acct 0110855565|RC 17608| 16 Subs| 1596 UsgRecs| 2 Secs| 430 CPUms| prmis2:26213 <MoveUsage d aemon needs to run... (7 Replies)
Discussion started by: rkrish
7 Replies

10. Shell Programming and Scripting

How to run a loop for assigning strings which are present in a file to an array

Hi Forum, I am struggling with the for loop in shell script. Let me explain what is needed in the script. I have a file which will conatin some strings like file1 place1 place2 place3 checkpoint some other text some more text Now what my requirement is the words ... (2 Replies)
Discussion started by: siri_14
2 Replies
Login or Register to Ask a Question