running select command from a script which takes input from a text file - Shell Scripting
This is a discussion on running select command from a script which takes input from a text file - Shell Scripting ; Hi,
I need to run select command repeatedly based on the inputs given in a text file which will be line by line..
eg:
txt file from which takes numbers as input:
123456789
234567891
345678912
the query should be like ...
-
running select command from a script which takes input from a text file
Hi,
I need to run select command repeatedly based on the inputs given in a text file which will be line by line..
eg:
txt file from which takes numbers as input:
123456789
234567891
345678912
the query should be like ' select ACK_PARTY_NAME,bus_event_seq_nbr from bus_event where ack_party_name like 'MOVE_USAGE_DAEMON%' and event_data_text like '%q%' where q= number from input file ..
The query should be in a loop which continuosly run until all the numbers of the input file covered.
Please anyone help me in this :-(
-
Re: running select command from a script which takes input from a text file

Originally Posted by
rput
Hi,
I need to run select command repeatedly based on the inputs given in a text file which will be line by line..
eg:
txt file from which takes numbers as input:
123456789
234567891
345678912
the query should be like ' select ACK_PARTY_NAME,bus_event_seq_nbr from bus_event where ack_party_name like 'MOVE_USAGE_DAEMON%' and event_data_text like '%q%' where q= number from input file ..
The query should be in a loop which continuosly run until all the numbers of the input file covered.
Please anyone help me in this :-(
If you are simply looking to go line by line through a file and have the contents of that line be put into "q=" then what about something like this:
$ for i in $(cat numbers)
> do
> echo "select ACK_PARTY_NAME,bus_event_seq_nbr from bus_event where ack_party_name like 'MOVE_USAGE_DAEMON%' and event_data_text like '%q%' where q=$i"
> done
[output]
select ACK_PARTY_NAME,bus_event_seq_nbr from bus_event where ack_party_name like 'MOVE_USAGE_DAEMON%' and event_data_text like '%q%' where q=123456789
select ACK_PARTY_NAME,bus_event_seq_nbr from bus_event where ack_party_name like 'MOVE_USAGE_DAEMON%' and event_data_text like '%q%' where q=234567891
select ACK_PARTY_NAME,bus_event_seq_nbr from bus_event where ack_party_name like 'MOVE_USAGE_DAEMON%' and event_data_text like '%q%' where q=345678912
[/output]
The contents of the file "numbers" is simply:
$ cat numbers
123456789
234567891
345678912
the "for" loop would go through each line till the EOF