Sponsored Content
Top Forums Shell Programming and Scripting Reading values from sql query Post 302825383 by rbatte1 on Monday 24th of June 2013 10:09:12 AM
Old 06-24-2013
It could be simplified by using:-
Code:
while read acc
do
   bip.sh $acc
done < sql_output.txt

This will loop for every record in your file. Be careful if you need to exclude things such as the column headings and numbers of row returned or blank lines.

If you have more than one column in the file and (for instance) the account number is in column 2 and you don't care about columns 1, 2 or three and from 5 onward, you could:-
Code:
while read col1 col2 col3 acc rest
do
   bip.sh $acc
done < sql_output.txt


You could run bip.sh 01 $acc if the 01 is a required parameter or even bip.sh 01 $acc & to run it in the background, but be careful if your file may have more than just a few records. There are limits to how many processes you should have running at the same time.



I hope that this helps


Robin
Liverpool/Blackburn
UK

Last edited by rbatte1; 06-24-2013 at 11:15 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

need help in reading a output of a sql query in unix script

i'm used a sql query in a unix script to get the information from table. but unable to extract the output which i need. Any help with logic will be greatly appreciated. my sql query provide output some thing like this - col1 col2 count ---- ---- ------ A B 10 c D 6 e... (8 Replies)
Discussion started by: pharos467
8 Replies

2. Shell Programming and Scripting

Reading values from a file using DB2 SQL

I have some alphbetical codes in that (1 Reply)
Discussion started by: kavithakuttyk
1 Replies

3. Shell Programming and Scripting

How to use sql data file in unix csv file as input to an sql query from shell

Hi , I used the below script to get the sql data into csv file using unix scripting. I m getting the output into an output file but the output file is not displayed in a separe columns . #!/bin/ksh export FILE_PATH=/maav/home/xyz/abc/ rm $FILE_PATH/sample.csv sqlplus -s... (2 Replies)
Discussion started by: Nareshp
2 Replies

4. Shell Programming and Scripting

Query Oracle tables and return values to shell script that calls the query

Hi, I have a requirement as below which needs to be done viz UNIX shell script (1) I have to connect to an Oracle database (2) Exexute "SELECT field_status from table 1" query on one of the tables. (3) Based on the result that I get from point (2), I have to update another table in the... (6 Replies)
Discussion started by: balaeswari
6 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. UNIX for Dummies Questions & Answers

Getting values of 2 columns from sql query in UNIX variables

Hi, I have connected to oracle database with sqlplus -s / <<EOF select ename, age from emp where empid=1234; EOF I want to save the values of ename and age in unix shell variables. Any pointers would be welcome.. Thanks in advance!!1 Cheers :):):):) (1 Reply)
Discussion started by: gonchusirsa
1 Replies

7. Shell Programming and Scripting

Query the table and return values to shell script and search result values from another files.

Hi, I need a shell script, which would search the result values from another files. 1)execute " select column1 from table_name" query on the table. 2)Based on the result, need to be grep from .wft files. could please explain about this.Below is the way i am using. #!/bin/sh... (4 Replies)
Discussion started by: Rami Reddy
4 Replies

8. Programming

Query SQL get two values differents from the same columns

Hi, I have 2 different values in the same column and two different values in other column Query 1 ins name value 1 Test 12345 1 TestV1 12/10/2014 8 Test 85435 8 TestV1 11/11/2005 9 Test 42232 9 TestV1 19/10/2000 6 Test 54321... (6 Replies)
Discussion started by: faka
6 Replies

9. Programming

Help writing SQL query

Hello All, I hope I'm posting this in the right section. I have zero sql query writing skill, in fact, I've never done it before, but for some reason, a request came across my desk to get information from one of our databases. I have about 200 ticket numbers that have no information attached,... (8 Replies)
Discussion started by: bbbngowc
8 Replies

10. Shell Programming and Scripting

Asign to variable ksh some values of sql query

Hi, I'm trying to asign to ksh varible some values of a sql query. The output query would be: xxxx 1 yyyy 2 I do: values=`$PATH_UTI/query_sh " select think1||'------'||think2 from some_table where think3 = '$1'; ... (2 Replies)
Discussion started by: mierdatuti
2 Replies
PLSTRIPC(3plplot)						    PLplot API							 PLSTRIPC(3plplot)

NAME
plstripc - Create a 4-pen stripchart SYNOPSIS
plstripc(id, xspec, yspec, xmin, xmax, xjump, ymin, ymax, xlpos, ylpos, y_ascl, acc, colbox, collab, colline, styline, legline[], labx, laby, labtop) DESCRIPTION
Create a 4-pen stripchart, to be used afterwards by plstripa(3plplot) Redacted form: General: plstripc(id, xspec, yspec, xmin, xmax, xjump, ymin, ymax, xlpos, ylpos, y_ascl, acc, colbox, collab, colline, sty- line, legline, labx, laby, labz) Perl/PDL: plstripc(xmin, xmax, xjump, ymin, ymax, xlpos, ylpos, y_ascl, acc, colbox, collab, colline, sty- line, id, xspec, ypsec, legline, labx, laby, labtop) This function is used in example 17. ARGUMENTS
id (PLINT *, output) Identification number of stripchart to use on plstripa(3plplot) and plstripd(3plplot). xspec (char *, input) X-axis specification as in plbox(3plplot). yspec (char *, input) Y-axis specification as in plbox(3plplot). xmin (PLFLT, input) Initial coordinates of plot box; they will change as data are added. xmax (PLFLT, input) Initial coordinates of plot box; they will change as data are added. xjump (PLFLT, input) When x attains xmax, the length of the plot is multiplied by the factor (1 + xjump). ymin (PLFLT, input) Initial coordinates of plot box; they will change as data are added. ymax (PLFLT, input) Initial coordinates of plot box; they will change as data are added. xlpos (PLFLT, input) X legend box position (range from 0 to 1). ylpos (PLFLT, input) Y legend box position (range from 0 to 1). y_ascl (PLBOOL, input) Autoscale y between x jumps if y_ascl is true, otherwise not. acc (PLBOOL, input) Accumulate strip plot if acc is true, otherwise slide display. colbox (PLINT, input) Plot box color index (cmap0). collab (PLINT, input) Legend color index (cmap0). colline (PLINT *, input) Pointer to array with color indices (cmap0) for the 4 pens. styline (PLINT *, input) Pointer to array with line styles for the 4 pens. legline (char **, input) Pointer to character array containing legends for the 4 pens. labx (char *, input) X-axis label. laby (char *, input) Y-axis label. labtop (char *, input) Plot title. AUTHORS
Geoffrey Furnish and Maurice LeBrun wrote and maintain PLplot. This man page was automatically generated from the DocBook source of the PLplot documentation, maintained by Alan W. Irwin and Rafael Laboissiere. SEE ALSO
PLplot documentation at http://plplot.sourceforge.net/resources. August, 2012 PLSTRIPC(3plplot)
All times are GMT -4. The time now is 03:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy