Sponsored Content
Top Forums Shell Programming and Scripting need to create a insert query for a file Post 302350832 by durden_tyler on Saturday 5th of September 2009 04:44:56 PM
Old 09-05-2009
Code:
$ 
$ cat f1
Fri Sep  4 06:25:51 2009
ACTION : 'CREATE INDEX S100S_DC.PLInsuranceReportRules_testI1     ON S100S_DC.PLInsuranceReportRules_test1(ENTITY_KEY)'
DATABASE USER: '/'
PRIVILEGE : SYSDBA
CLIENT USER: oracle
CLIENT TERMINAL: pts/3
STATUS: 0

Fri Sep  4 06:28:41 2009
ACTION : 'GRANT DELETE ON S100S_DC.PLInsuranceReportRules_test1 TO   DC_DATACHG_ROLE'
DATABASE USER: '/'
PRIVILEGE : SYSDBA
CLIENT USER: oracle
CLIENT TERMINAL: pts/3
STATUS: 0

Fri Sep  4 06:39:22 2009
ACTION : 'OCIDescribeAny'
DATABASE USER: 'S1'
PRIVILEGE : SYSDBA
CLIENT USER: oracle
CLIENT TERMINAL: pts/3
STATUS: 0
$ 
$ 
$ ##
$ perl -ne 'BEGIN {$q=chr(39)} chomp;
>           if (/^$/){print $s,");\n"; $s=""}
>           elsif (/\d{4}$/){$s="Insert into table values (".$q.$_.$q}
>           else {@x=split/: /;
>                 if (/^(ACTION|DATABASE)/){$s .= ",".$x[1]}
>                 else {$s .= ",".$q.$x[1].$q}}
>           END {print $s,");\n"}' f1
Insert into table values ('Fri Sep  4 06:25:51 2009','CREATE INDEX S100S_DC.PLInsuranceReportRules_testI1     ON S100S_DC.PLInsuranceReportRules_test1(ENTITY_KEY)','/','SYSDBA','oracle','pts/3','0');
Insert into table values ('Fri Sep  4 06:28:41 2009','GRANT DELETE ON S100S_DC.PLInsuranceReportRules_test1 TO   DC_DATACHG_ROLE','/','SYSDBA','oracle','pts/3','0');
Insert into table values ('Fri Sep  4 06:39:22 2009','OCIDescribeAny','S1','SYSDBA','oracle','pts/3','0');
$ 
$

tyler_durden
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

create Insert script from a file

Hi , I have a text file text.txt which contains values as ULTRA,OTHERS,Mumbai,16912 ULTIMATE,OTHERS,Mumbai,16913 ULTIMATIUM,OTHERS,Mumbai,16914 I want to read the file line by line and create insert scripts like INSERT INTO TAB ( DESC,PLACE,NUMBER ) VALUES... (3 Replies)
Discussion started by: ultimatix
3 Replies

2. Shell Programming and Scripting

to create a export query from a file

Hi Guys,,, I have a file which is of this type. abdc defd afds adfse I want to create a export statement like this. Db2 "export to /clocal/rem/user/rem/used.txt of del select * from t.tel where name in ('abdc','defd','afds','adfse') with ur" Please help me.. Thanks for... (2 Replies)
Discussion started by: mac4rfree
2 Replies

3. Programming

SQL : Fine tune Insert by query

i would like to know how can i fine tune the following query since the cost of the query is too high .. insert into temp temp_1 select a,b,c,d from xxxx .. database used is IDS.. (1 Reply)
Discussion started by: expert
1 Replies

4. Shell Programming and Scripting

How to use a variable in insert query?

My script contains as follows, VALUE=`sqlplus un/pwd <<EOF > OB.txt set pagesize 0 feedback off verify off heading off echo off select max(1) from table1; exit; EOF` insert into table2 values(1, 'The max value is $value',...); i need the value of VALUE to be inserted after 'The max... (2 Replies)
Discussion started by: savithavijay
2 Replies

5. Shell Programming and Scripting

Forming an insert query using awk

Hi, I'm trying to form an insert sql query using shell programming. I have table named company with four columns 'company name', 'company id', 'company code' and 'last change id' I have to read the company name, company code and last change id from a file delimited by | which has around 10... (4 Replies)
Discussion started by: rakesh_s
4 Replies

6. Programming

insert query help

Hello i want help to load data from file into mysql DB this part i know how to do but during loading i want to combine 2 fields into 1 field and insert into db as primary key in new column thanks advice how to do so (5 Replies)
Discussion started by: mogabr
5 Replies

7. Shell Programming and Scripting

Create SQL DML insert statements from file using AWK or similar

Hi all. This is my first post on this forum. I've previously found great help in the huge knowledgebase that is here, but this time I have not been able to find a solution to my problem. I have a large text file that looks like this: typedef struct ABC_struct_nbr1_ { char attr1; /*... (0 Replies)
Discussion started by: Yagi Uda
0 Replies

8. Shell Programming and Scripting

Insert query with shell variable with AWK

Hi, I'm a first timer with Unix so pardon my ignorance. I'm trying to read a comma separated file from the same folder where the script is and insert the value in a DB2 table. I'm using AWK for the same. I'm getting `)' not expected error. I'm not sure but for me it doesn't look like detailed... (8 Replies)
Discussion started by: Kabira Speaking
8 Replies

9. Shell Programming and Scripting

From sql Insert Query to XML format

Hi How do I translate Let say Cat inserts.sql gives Insert into PM9_TAXATION_ROUNDING (STATE_GECODE, TAX_TYPE, TAX_AUTHORITY, SYS_CREATION_DATE, SYS_UPDATE_DATE, APPLICATION_ID, DL_SERVICE_CODE, ROUNDING_METHOD) Values ('xx', 'xx', 'x', TO_DATE('10/26/2012 13:01:20',... (3 Replies)
Discussion started by: anuj87in
3 Replies

10. Shell Programming and Scripting

How to create a file from output of vertica table query in UTF-8 format?

Hello, In my shell script, I extract table data from HP Vertica DB into a csv file using vsql -c command. But the problem is the file getting created is in binary format and hence some of the data becomes unreadable which has chinese characters as part of data. file -i filename.csv - gives... (2 Replies)
Discussion started by: Dharmatheja
2 Replies
PTS_HELP(1)						       AFS Command Reference						       PTS_HELP(1)

NAME
pts_help - Displays help for pts commands SYNOPSIS
pts help [-topic <help string>+] [-help] pts h [-t <help string>+] [-h] DESCRIPTION
The pts help command displays the complete online help entry (short description and syntax statement) for each command operation code specified by the -topic argument. If the -topic argument is omitted, the output includes the first line (name and short description) of the online help entry for every pts command. To list every pts command whose name or short description includes a specified keyword, use the pts apropos command. OPTIONS
-topic <help string>+ Indicates each command for which to display the complete online help entry. Omit the pts part of the command name, providing only the operation code (for example, specify "membership", not "pts membership"). If this argument is omitted, the output briefly describes every pts command. -help Prints the online help for this command. All other valid options are ignored. OUTPUT
The online help entry for each pts command consists of the following two or three lines: o The first line names the command and briefly describes its function. o The second line lists aliases for the command, if any. o The final line, which begins with the string "Usage", lists the command's options in the prescribed order. Online help entries use the same symbols (for example, brackets) as the reference pages in this document. EXAMPLES
The following command displays the online help entry for the pts membership command: % pts help membership pts membership: list membership of a user or group aliases: groups Usage: pts membership -nameorid <user or group name or id>+ [-cell <cell name>] [-noauth] [-force] [-help] PRIVILEGE REQUIRED
None SEE ALSO
pts(1), pts_apropos(1) COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved. This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell. OpenAFS 2012-03-26 PTS_HELP(1)
All times are GMT -4. The time now is 11:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy