Sponsored Content
Top Forums Shell Programming and Scripting Storing passing and executing select statement in loop Post 302953104 by RavinderSingh13 on Tuesday 25th of August 2015 11:06:34 AM
Old 08-25-2015
Hello Khushbu,

Kindly use code tags as per forum rules while posting any command/codes/Inputs in your posts, following may help you in same.
Code:
 grep -Eo '[0-9]{15}' filename1 > demo.txt
 ### To print only the select statements following.
 awk '{print "select * from tablename where ID= " $0}' demo.txt
  
 ### To take output in a output file if happy with above print command.
 awk '{print "select * from tablename where ID= " $0}' demo.txt > output.txt
  
 ### In case you need your id inclosed within ' then following may help.
 awk -vs1-"'" '{print "select * from tablename where ID= " s1 $0 s1}' demo.txt

Hope above helps you.


Thanks,
R. Singh
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Reading from a file and passing the value to a select query

Hi all, Here is my problem. I want to read data from a file and pass the variable to a select query. I tried but it doesn't seem to work. Please advise. Example below. FileName='filekey.txt' while read LINE do var=$LINE print "For File key $var" ${ORACLE_HOME}/bin/sqlplus -s... (1 Reply)
Discussion started by: er_ashu
1 Replies

2. UNIX and Linux Applications

Oracle Select IN statement

If I recall, when I used informix I could do a sql statement like: SELECT Value from Table WHERE ID in (100,200,300); How do I do this in Oracle? I believe I am using Oracle 10 if that matters. Thanks. (1 Reply)
Discussion started by: benefactr
1 Replies

3. Shell Programming and Scripting

using SELECT sql statement in shell script

Hi there I have a database on a remote box and i have been using shell script to insert data into it for example, i could have a script that did this SN=123456 n=server1 m=x4140 sql="UPDATE main SET hostname='$n',model='$m' WHERE serial='$SN';" echo $sql |/usr/sfw/bin/mysql -h... (4 Replies)
Discussion started by: hcclnoodles
4 Replies

4. Shell Programming and Scripting

How can i assign an select statement into a variable?

I am trying to assign an select statement into a variable. Can someone hel me with this. example : a='select * from dual' echo $a should give me select * from dual But this is not working. I trying with \ before * and quotes too. (1 Reply)
Discussion started by: rdhanek
1 Replies

5. Shell Programming and Scripting

Select variable within a if statement

i want to select a variable created and use it in a if statement, but not getting the desired results LINE='device for 0101a01: lpd://172.25.41.111:515' prt=`echo $LINE | awk '{print $3 }' | cut -c 1-7` echo $prt My if statement to select just what i want.. IFS=$":" while read prt... (11 Replies)
Discussion started by: ggoliath
11 Replies

6. Shell Programming and Scripting

for each value in an array, execute select statement

Hello All, I am new to shell scripting. I am working on Solaris O/S, bash script and sybase programming. I want to loop through multiple values in an array and for each value, I want to select a row from the database. following is the code written for it. output="loop.csv" ... (8 Replies)
Discussion started by: arundhati_s
8 Replies

7. Shell Programming and Scripting

Reading a string and passing passing arguments to a while loop

I have an for loop that reads the following file cat param.cfg val1:env1:opt1 val2:env2:opt2 val3:env3:opt3 val4:env4:opt4 . . The for loop extracts the each line of the file so that at any one point, the value of i is val1:env1:opt1 etc... I would like to extract each... (19 Replies)
Discussion started by: goddevil
19 Replies

8. Shell Programming and Scripting

Help in executing select query from perl script

Hi, I have a perl snippet that call a select query with a bind variable,when i compile the script I'm unable to get the query output. The same query when i fire in sqlplus fetches few rows. The query takes bit time to fetch results in sqlplus. my $getaccts = $lda->prepare("select distinct ... (1 Reply)
Discussion started by: rkrish
1 Replies

9. Shell Programming and Scripting

Problem with select statement

Hi I have run out of ideas as to why this select doesn't work in a script I am writing. The script sources a file of common functions and I am trying to use a select statement within one of the functions - PS3="Try? " select X in CONT EXIT; do if ] ... (4 Replies)
Discussion started by: steadyonabix
4 Replies

10. Shell Programming and Scripting

SQLPLUS command with more than 1 select statement

Hi all, I'm using below code processId=`sqlplus -s ${sysuser}/${syspwd} <<CHK_PROCESS whenever sqlerror exit sql.sqlcode; set head off feedback off echo off pages 0 SELECT PROCESS_ID FROM LSHADMIN.DATA_DOMAIN WHERE DOMAIN_NAME = '${tabname}' ... (8 Replies)
Discussion started by: Pratiksha Mehra
8 Replies
metacity-window-demo(1) 					   User Commands					   metacity-window-demo(1)

NAME
metacity-window-demo - demonstrate the different types of windows that the window manager can manage SYNOPSIS
metacity-window-demo DESCRIPTION
You can use the metacity-window-demo application to demonstrate the different types of windows that the window manager can manage, and show how each window is themed. EXAMPLES
Example 1: Launching the Window Demonstration example% metacity-window-demo EXIT STATUS
The following exit values are returned: 0 Application exited successfully >0 Application exited with failure FILES
The following files are used by this application: /usr/bin/metacity-windowExecutable to launch window manager demonstration ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-wm | +-----------------------------+-----------------------------+ |Interface stability |External | +-----------------------------+-----------------------------+ SEE ALSO
Latest version of the GNOME Desktop User Guide for your platform. metacity(1), metacity-message(1), metacity-properties(1), metacity-theme-viewer(1) NOTES
Written by Glynn Foster, Sun Microsystems Inc., 2004. SunOS 5.10 6 Sep 2004 metacity-window-demo(1)
All times are GMT -4. The time now is 01:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy