Sponsored Content
Top Forums Shell Programming and Scripting awk/sed script to read values from parameter files Post 302254829 by zaxxon on Wednesday 5th of November 2008 09:22:09 AM
Old 11-05-2008
You could do something like for example:
Code:
DB=DB1
for LINE in `sed -n '/ '${DB}' /,/ End /p' infile| grep -v ^#`; do
     export "${LINE}"
done

Where instead of variable DB you can use $1 for input.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help!! Need script to read files and add values by lines...

Hi All, I really need your help. I am a begginner in shell script and I believe this is a very simple issue. I have in my directory, n-files, like 1.dhm, 2.dhm, 3.dhm. These files have 1 column with 1 value per line, like: 1.dhm ------ 10 20 30 40 50 2.dhm ------ 30 50 20 (3 Replies)
Discussion started by: dhuertas
3 Replies

2. UNIX for Dummies Questions & Answers

checking parameter values passed to script

Hi, I will pass 3 parameters for a script.I have to check the file name and create a new file name with time stamp. the parameters which i'm passing are /dir/stg/filename.txt /dir/path/head.txt /dir/path/tail.txt Now i have to check filename like : if it is a.txt i have to create... (2 Replies)
Discussion started by: ammu
2 Replies

3. UNIX for Advanced & Expert Users

Compare two files using awk or sed, add values in a column if their previous fields are same

Hi All, I have two files file1: abc,def,ghi,5,jkl,mno pqr,stu,ghi,10,vwx,xyz cba,ust,ihg,4,cdu,oqw file2: ravi,def,kishore ramu,ust,krishna joseph,stu,mike I need two output files as follows In my above example, each row in file1 has 6 fields and each row in file2 has 3... (1 Reply)
Discussion started by: yerruhari
1 Replies

4. UNIX for Dummies Questions & Answers

Compare two files using awk or sed, add values in a column if their previous fields are same

Hi All, I have two files file1: abc,def,ghi,5,jkl,mno pqr,stu,ghi,10,vwx,xyz cba,ust,ihg,4,cdu,oqw file2: ravi,def,kishore ramu,ust,krishna joseph,stu,mike I need two output files as follows In my above example, each row in file1 has 6 fields and each row in file2 has 3... (1 Reply)
Discussion started by: yerruhari
1 Replies

5. Shell Programming and Scripting

Compare two files using awk or sed, add values in a column if their previous fields are same

Hi All, I have two files file1: abc,def,ghi,5,jkl,mno pqr,stu,ghi,10,vwx,xyz cba,ust,ihg,4,cdu,oqw file2: ravi,def,kishore ramu,ust,krishna joseph,stu,mike I need two output files as follows In my above example, each row in file1 has 6 fields and each row in file2 has 3... (3 Replies)
Discussion started by: yerruhari
3 Replies

6. Shell Programming and Scripting

AWK: read values from file1; search for values in file2

I have read another post about this issue and am wondering how to adapt it to my own, much simpler, issue. I have a file of user IDs like so: 333333 321321 546465 ...etc I need to take each number and use it to print records wherein the 5th field matches the user ID pulled from the... (2 Replies)
Discussion started by: Bubnoff
2 Replies

7. Shell Programming and Scripting

'Couldn't read file' error in bash script with expect, sed and awk!

Ok, so I have a bash script with an embedded expect statement. Inside of the expect statement, i'm trying to pull all of the non-comment lines from the /etc/oratab file one at a time. Here's my command: cat /etc/oratab |sed /^s*#/d\ | awk 'NR==1'|awk -F: '{print \"$1\"}'|. oraenv Now,... (0 Replies)
Discussion started by: alexdglover
0 Replies

8. Shell Programming and Scripting

awk file to read values from Db2 table replacing hard coded values

Hi, I want to replace a chain of if-else statement in an old AWK file with values from Db2 table or CSV file. The part of code is below... if (start_new_rec=="true"){ exclude_user="false"; user=toupper($6); match(user, "XXXXX."); if (RSTART ==2 ) { ... (9 Replies)
Discussion started by: asandy1234
9 Replies

9. UNIX for Beginners Questions & Answers

awk GSUB read field values from multiple text files

My program run without error. The problem I am having. The program isn't outputting field values with the column headers to file.txt. Each of the column headers in file.txt has no data. MEMSIZE SECOND SASFoundation Filename The output results in file.txt should show: ... (1 Reply)
Discussion started by: dellanicholson
1 Replies

10. UNIX for Beginners Questions & Answers

Script parameter with several values

Hi, On ksh I have to write a script tha I will run like this: ./myscript.ksh -param1 val1 val2 val3 .. -param2 xxx -param3 hgf Param1 will be an array: param1= ( val1 val2 val3 ..... ) How can I do that? It is not a homework!! Thank you. (1 Reply)
Discussion started by: big123456
1 Replies
DB2_PROCEDURE_COLUMNS(3)						 1						  DB2_PROCEDURE_COLUMNS(3)

db2_procedure_columns - Returns a result set listing stored procedure parameters

SYNOPSIS
resource db2_procedure_columns (resource $connection, string $qualifier, string $schema, string $procedure, string $parameter) DESCRIPTION
Returns a result set listing the parameters for one or more stored procedures. PARAMETERS
o $connection - A valid connection to an IBM DB2, Cloudscape, or Apache Derby database. o $qualifier - A qualifier for DB2 databases running on OS/390 or z/OS servers. For other databases, pass NULL or an empty string. o $schema - The schema which contains the procedures. This parameter accepts a search pattern containing _ and % as wildcards. o $procedure - The name of the procedure. This parameter accepts a search pattern containing _ and % as wildcards. o $parameter - The name of the parameter. This parameter accepts a search pattern containing _ and % as wildcards. If this parameter is NULL, all parameters for the specified stored procedures are returned. RETURN VALUES
Returns a statement resource with a result set containing rows describing the parameters for the stored procedures matching the specified parameters. The rows are composed of the following columns: +---------------------------+---------------------------------------------------+ | Column name | | | | | | | Description | | | | +---------------------------+---------------------------------------------------+ | PROCEDURE_CAT | | | | | | | The catalog that contains the procedure. The | | | value is NULL if this table does not have cata- | | | logs. | | | | | PROCEDURE_SCHEM | | | | | | | Name of the schema that contains the stored pro- | | | cedure. | | | | | PROCEDURE_NAME | | | | | | | Name of the procedure. | | | | | COLUMN_NAME | | | | | | | Name of the parameter. | | | | | COLUMN_TYPE | | | | | | | An integer value representing the type of the | | | parameter: | | | | | | box, tab (|); c | c | . T{ Return value | | | | | | Parameter type | | | | +---------------------------+---------------------------------------------------+ | 1 (SQL_PARAM_INPUT) | | | | | | | Input (IN) parameter. | | | | |2 (SQL_PARAM_INPUT_OUTPUT) | | | | | | | Input/output (INOUT) parameter. | | | | | 3 (SQL_PARAM_OUTPUT) | | | | | | | Output (OUT) parameter. | | | | +---------------------------+---------------------------------------------------+ T} T{ DATA_TYPE T} |T{ The SQL data type for the parameter represented as an integer value. T} T{ TYPE_NAME T} |T{ A string representing the data type for the parameter. T} T{ COLUMN_SIZE T} |T{ An integer value representing the size of the parameter. T} T{ BUFFER_LENGTH T} |T{ Maximum number of bytes necessary to store data for this parameter. T} T{ DECIMAL_DIGITS T} |T{ The scale of the parameter, or NULL where scale is not applicable. T} T{ NUM_PREC_RADIX T} |T{ An integer value of either 10 (representing an exact numeric data type), 2 (representing an approximate numeric data type), or NULL (rep- resenting a data type for which radix is not applicable). T} T{ NULLABLE T} |T{ An integer value representing whether the parameter is nullable or not. T} T{ REMARKS T} |T{ Description of the parameter. T} T{ COLUMN_DEF T} |T{ Default value for the parameter. T} T{ SQL_DATA_TYPE T} |T{ An integer value representing the size of the parameter. T} T{ SQL_DATETIME_SUB T} |T{ Returns an integer value representing a datetime subtype code, or NULL for SQL data types to which this does not apply. T} T{ CHAR_OCTET_LENGTH T} |T{ Maximum length in octets for a character data type parameter, which matches COLUMN_SIZE for single-byte character set data, or NULL for non-character data types. T} T{ ORDINAL_POSITION T} |T{ The 1-indexed position of the parameter in the CALL statement. T} T{ IS_NULLABLE T} |T{ A string value where 'YES' means that the parameter accepts or returns NULL values and 'NO' means that the parameter does not accept or return NULL values. T} SEE ALSO
db2_column_privileges(3), db2_columns(3), db2_foreign_keys(3), db2_primary_keys(3), db2_procedures(3), db2_special_columns(3), db2_statis- tics(3), db2_table_privileges(3), db2_tables(3). PHP Documentation Group DB2_PROCEDURE_COLUMNS(3)
All times are GMT -4. The time now is 03:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy