Sponsored Content
Top Forums Shell Programming and Scripting How to call a string by string from a file to use in for loop? Post 303003830 by Samah on Thursday 21st of September 2017 07:22:32 AM
Old 09-21-2017
Thanks for the reply !

I am using Netezza and i have just given an example with a single query and i have given all the connection strings to access and once the first query returns the results then a set of queries needs to execute..so i have to put this in loop.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

search string in a file and retrieve 10 lines including string line

Hi Guys, I am trying to write a perl script to search a string "Name" in the file "FILE" and also want to create a new file and push the searched string Name line along with 10 lines following the same. can anyone of you please let me know how to go about it ? (8 Replies)
Discussion started by: sukrish
8 Replies

2. Shell Programming and Scripting

replace (sed?) a single line/string in file with multiple lines (string) from another file??

Can someone tell me how I can do this? e.g: Say file1.txt contains: today is monday the 22 of NOVEMBER 2010 and file2.txt contains: the 11th month of How do i replace the word NOVEMBER with (5 Replies)
Discussion started by: tuathan
5 Replies

3. Shell Programming and Scripting

sed or awk command to replace a string pattern with another string based on position of this string

here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb cat dump.sql INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies

4. Shell Programming and Scripting

grep exact string from files and write to filename when string present in file

I am attempting to grep an exact string from a series of files within a directory and append that output to the filename when it is present in the file. I've been after this all day with no luck. Thanks for your help in advance :wall:. (4 Replies)
Discussion started by: JC_1
4 Replies

5. Shell Programming and Scripting

Recursive search for string in file with Loop condition

Hi, Need some help... I want to execute sequence commands, like below test1.sh test2.sh ...etc test1.sh file will generate log file, we need to search for 'complete' string on test1.sh file, once that condition success and then it should go to test2.sh file, each .sh scripts will take... (5 Replies)
Discussion started by: rkrish123
5 Replies

6. Shell Programming and Scripting

Search a string in a text file and add another string at the particular position of a line

I am having a text file which is having more than 200 lines. EX: 001010122 12000 BIB 12000 11200 1200003 001010122 2000 AND 12000 11200 1200003 001010122 12000 KVB 12000 11200 1200003 In the above file i want to search for string KVB and add/replace... (1 Reply)
Discussion started by: suryanarayana
1 Replies

7. Shell Programming and Scripting

Search a string in a text file and add another string at the end of line

Dear All I am having a text file which is having more than 200 lines. EX: 001010122 12000 BIB 12000 11200 1200003 001010122 2000 AND 12000 11200 1200003 001010122 12000 KVB 12000 11200 1200003 In the above file i want to search for string KVB... (5 Replies)
Discussion started by: suryanarayana
5 Replies

8. UNIX for Beginners Questions & Answers

Search a string and display its location on the entire string and make a text file

I want to search a small string in a large string and find the locations of the string. For this I used grep "string" -ob <file name where the large string is stored>. Now this gives me the locations of that string. Now how do I store these locations in a text file. Please use CODE tags as... (7 Replies)
Discussion started by: ANKIT ROY
7 Replies

9. Shell Programming and Scripting

Use while loop to read file and use ${file} for both filename input into awk and as string to print

I have files named with different prefixes. From each I want to extract the first line containing a specific string, and then print that line along with the prefix. I've tried to do this with a while loop, but instead of printing the prefix I print the first line of the file twice. Files:... (3 Replies)
Discussion started by: pathunkathunk
3 Replies

10. Shell Programming and Scripting

Replace string of a file with a string of another file for matches using grep,sed,awk

I have a file comp.pkglist which mention package version and release . In 'version change' and 'release change' line there are two versions 'old' and 'new' Version Change: --> Release Change: --> cat comp.pkglist Package list: nss-util-devel-3.28.4-1.el6_9.x86_64 Version Change: 3.28.4 -->... (1 Reply)
Discussion started by: Paras Pandey
1 Replies
PREPARE(7)							   SQL Commands 							PREPARE(7)

NAME
PREPARE - create a prepared query SYNOPSIS
PREPARE plan_name [ (datatype [, ...] ) ] AS query INPUTS plan_name An arbitrary name given to this particular prepared query. It must be unique within a single session, and is used to execute or remove a previously prepared query. datatype The data-type of a parameter to the prepared query. To refer to the parameters in the prepared query itself, use $1, $2, etc. OUTPUTS PREPARE The query has been prepared successfully. DESCRIPTION
PREPARE creates a prepared query. A prepared query is a server-side object that can be used to optimize performance. When the PREPARE statement is executed, the specified query is parsed, rewritten, and planned. When a subsequent EXECUTE statement is issued, the prepared query need only be executed. Thus, the parsing, rewriting, and planning stages are only performed once, instead of every time the query is executed. Prepared queries can take parameters: values that are substituted into the query when it is executed. To specify the parameters to a pre- pared query, include a list of data-types with the PREPARE statement. In the query itself, you can refer to the parameters by position using $1, $2, etc. When executing the query, specify the actual values for these parameters in the EXECUTE statement -- refer to EXECUTE [execute(7)] for more information. Prepared queries are stored locally (in the current backend), and only exist for the duration of the current database session. When the client exits, the prepared query is forgotten, and so it must be re-created before being used again. This also means that a single prepared query cannot be used by multiple simultaneous database clients; however, each client can create their own prepared query to use. Prepared queries have the largest performance advantage when a single backend is being used to execute a large number of similar queries. The performance difference will be particularly significant if the queries are complex to plan or rewrite. For example, if the query involves a join of many tables or requires the application of several rules. If the query is relatively simple to plan and rewrite but rel- atively expensive to execute, the performance advantage of prepared queries will be less noticeable. NOTES In some situations, the query plan produced by PostgreSQL for a prepared query may be inferior to the plan produced if the query were sub- mitted and executed normally. This is because when the query is planned (and the optimizer attempts to determine the optimal query plan), the actual values of any parameters specified in the query are unavailable. PostgreSQL collects statistics on the distribution of data in the table, and can use constant values in a query to make guesses about the likely result of executing the query. Since this data is unavailable when planning prepared queries with parameters, the chosen plan may be sub-optimal. For more information on query planning and the statistics collected by PostgreSQL for query optimization purposes, see the ANALYZE [ana- lyze(7)] documentation. COMPATIBILITY
SQL92 SQL92 includes a PREPARE statement, but it is only for use in embedded SQL clients. The PREPARE statement implemented by PostgreSQL also uses a somewhat different syntax. SQL - Language Statements 2002-11-22 PREPARE(7)
All times are GMT -4. The time now is 05:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy