Sponsored Content
Top Forums UNIX for Dummies Questions & Answers unix script with SQL statement problem Post 302609473 by happyv on Tuesday 20th of March 2012 02:42:51 AM
Old 03-20-2012
unix script with SQL statement problem

Hello,

I have a script to get the information from database, however, it's look like the loop is not work, can someone help? Smilie

echo Input file list to check:
read filelist
for file in 'cat $filelist.txt'
do
echo "select FILENAME from FILE_TABLE where filename like '${file}'%;" >> output_file.txt
done
echo Completed Check!!


The filelist is:
list1
A1-67630403
A2-04985959
B3-04857858
B6-058744748
C10-59584583
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Creating an sql statement from a file. Problem with '

Hi, I am trying to create sql statements from a file, but I have a problem with ': This is what I do: cat filex.txt | awk -F: '{print $1,"A","and personnavn like",$5}' | sed -e "s/^/select bruker.brukernavn, person.personnavn from bruker, person where brukernavn like '/" -e "s/$/' and... (2 Replies)
Discussion started by: hannem
2 Replies

2. Shell Programming and Scripting

Executing a Oracle SQL statement in a UNIX script

Hi All, I need to select one column from a table based upon the passed in parameter. I tried this: sqlplus -silent $MISP_USER << EOF set feedback off; set verify off; set sqlprompt "" SELECT mail_flag FROM dailyjobs WHERE job_name = '$1'; exit 0 EOF exit... (1 Reply)
Discussion started by: ganga.dharan
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 to call an sql script inside a while statement in KSH

Hi all, I'm trying to run an sql inside a loop which looks like this #!bin/ksh while IFS=, read var1 var2 do sqlplus -s ${USERNAME}/${PASSWORD}@${ORACLE_SID} << EOF insert into ${TABLE} ( appt_date ) values ( '${var1 }' ); ... (6 Replies)
Discussion started by: ryukishin_17
6 Replies

5. Shell Programming and Scripting

Unix shell command output to a sql statement

Can i do this Say one command sed 's/:*/ /g' $summf is returning C1234 C2345 C3434 some no of rows, now this ouput i have to insert it into a DB table how do i do this?? (2 Replies)
Discussion started by: depakjan
2 Replies

6. Shell Programming and Scripting

Read SQL statement in Script

Hi Guys.. need some urgent help... I am stuck in something badly I need to write a script which would read a sql statement (which might be a join/inner join/select/sub select etc. ) I need to read that sql statement ... and in the output I want all the table names and columns (doesn't... (4 Replies)
Discussion started by: freakygs
4 Replies

7. UNIX for Dummies Questions & Answers

SQL statement is not work on unix script

Hi, I have the following basic script. However, the statement (line 5) is not work. The output data is not able to set my request format a30. Any advise? :mad: echo " Column filename format a30"|sqlplus4 echo Input file list to check: read filelist for file in `cat $filelist.txt` do... (1 Reply)
Discussion started by: happyv
1 Replies

8. Shell Programming and Scripting

UNIX variable to SQL statement

The following is my script : #!/bin/bash echo "please give app_instance_id" read app_instance_id echo "id is $app_instance_id" export app_id=app_instance_id sqlplus -s nnviewer/lookup@//nasolora008.enterprisenet.org:1521/LOAD3 @test.sql<<EOF SPOOL /home/tibco/MCH/Data/qa/raak/name.xls... (4 Replies)
Discussion started by: raakeshr
4 Replies

9. Shell Programming and Scripting

How to create SQL statement out of data using shell script?

Table TAB1 contains following example data (its a tree sitting in table data format & its driven based CHILD & PARENT column pick the RULE condition to generate the below SQL: CHILD PARENT SS MID MNM VNM RULE FLG 1 ? S1 ? ? V1 rule004 I 2 1 S1 ? ? V1 0 Z 3 1 S1 ? ? V1 1 Z ... (6 Replies)
Discussion started by: gksenthilkumar
6 Replies

10. Shell Programming and Scripting

UNIX Sqlplus - Capture the sql statement about to run and execution status

Greetings Experts, I am on AIX using ksh. Created a unix script which generates the CREATE OR REPLACE VIEW ... and GRANT .. statements, which are placed in a single .txt file. Now I need to execute the contents in the file (there are around 300 view creation and grant statements) in Oracle and... (4 Replies)
Discussion started by: chill3chee
4 Replies
AVINFO(1)							   User Commands							 AVINFO(1)

NAME
AVInfo - Audio/Video file information automatic extractor SYNOPSIS
avinfo [FILENAME] [OPTIONS] [TEMPLATE] [OUTPUT] avinfo [-l=FILELIST] [OPTIONS] [TEMPLATE] [OUTPUT] avinfo -l- [OPTIONS] [TEMPLATE] [OUTPUT] avinfo [--help | --version] DESCRIPTION
Extracts information from FILENAME or files in FILELIST and generates a report. OPTIONS: -f=extension forces the use of module associated with extension -l=list use filelist (use -l- for stdin) -i=ms delay between files in filelist (in ms) (/*TODO*/) -e=ext exclude an extension (do not apply associated module) -m=number max line length (0 - no restriction) -s=value for advanced tuning of modules (/*TODO*/) -v=name=value set int. variable 'name' to 'value' (text or number) External TEMPLATEs: -th=template header template (string, use without value to disable) -thf=filename get header template from a file -tb=template body template (string, use without value to disable) -tbf=filename get body template from a file -tf=template footer template (string, use without value to disable) -tff=filename get footer template from a file Built-in TEMPLATEs: --default used by default --description for creating (updating) descrpipt.ion files --list for filelist (plain text) generation --html-list for filelist (html) generation --csv-list for filelist (CSV, e.g. for Excel) --short alt. version of --default template --far "nice" formated report (for FAR Manager) (contains MS-DOS pseudographic characters) OUTPUT: -o=file file to write the report to (default is stdout) Other OPTIONS: --help prints this help page --version prints avinfo version and copyright You can use ':' instead of '=' in all OPTIONS or just omit it. TEMPLATEs use AVInfo Simple Script (A.S.S.) syntax. Examples of commands: avinfo file.ogm --raw find . -name '*.avi' -print | avinfo -l- --html-list -o=avilist.html avinfo -l:list -thf:header -tbf=body -tff=footer >report SEE ALSO
Additional documentation for AVInfo can be found in the package documentation directory. (c) George Shuklin, 2001-2004, http://shounen.ru/soft/avinfo/ This is free software. You are welcome to redistribute it under the terms and conditions of GNU General Public License. AVInfo 1.0 alpha 15 [Balalaika] April 2005 AVINFO(1)
All times are GMT -4. The time now is 02:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy