Sponsored Content
Top Forums Shell Programming and Scripting Python Script to take file count and insert into DB2 table Post 303010077 by Don Cragun on Tuesday 26th of December 2017 06:17:16 AM
Old 12-26-2017
Building on what RudiC has already asked... Are we correct in assuming:
  1. you want the number of lines in each selected file - 1,
  2. all of the files you want to process can be selected by the filename matching pattern /var/tmp/*/*.csv,
  3. all filenames end with an eight digit date string in the format YYYYMMDD followed by the string .csv, and
  4. within each directory under /var/tmp, the string before the date string is a constant?
Do you want the line count from each selected file in a directory or do you want the sum of the line counts from the selected files in all of the directories containing *.csv files?

What operating system and shell are you using?

Since you're already using awk, is it OK to just use awk without adding php or python code?

Does the awk you are using on your system have the nextfile command?
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

unix script for update or insert records from a file to a oracle table

Hi, I have delimited file(|). Sample data: 1|name|50009|DS24|0|12 2|name|30009|DS24|0|13 3|name|20409|DS24|0|14 4|name|20009|DS24|0|15 5|name|10009|DS24|0|16 I want to load this data into a oracle table (update and insert) Please help me the commands and also... (1 Reply)
Discussion started by: unihp1
1 Replies

2. Shell Programming and Scripting

How to connect DB2 table using shell script

Hi All, I want to connect two tables in DB2 using shell script and then compare the contents of two tables field by field. Could any one please help me in connecting database tables using Unix and retriving data from the same. Thanks, Durwas (0 Replies)
Discussion started by: dtidke
0 Replies

3. UNIX for Dummies Questions & Answers

Advice on extracting special characters from a DB2 table to a file in the UNIX ENV

need some advice on the following situation. I have a DB2 table which has a varchar Column. This varchar column can have special characters like ©, ®, ™ . When I extract from this table to a sequential file for this varchar column I am only able to get © and ® . To Get the ™... (1 Reply)
Discussion started by: cosec
1 Replies

4. Shell Programming and Scripting

Export data from DB2 table to .txt file(space delimited)

Hi I need help on this. Its very urgent for me.. please try to help me out.. I have data in tables in DB2 database. I would like to export the data from DB2 tables into a text file, which has to be space delimited. so that I can carry out awk, grep operations on that file. I tried to export... (2 Replies)
Discussion started by: ss3944
2 Replies

5. Shell Programming and Scripting

select values from db1 table and insert into table of DB2

Hi I am having three oracle databases running in three different machine. their ip address is different. from one of the DB am able to access both the databases.(means am able to select values and insert values in to tables individually.) I need to fetch some data from DB1 table(say DB1 ip is... (2 Replies)
Discussion started by: aemunathan
2 Replies

6. UNIX for Dummies Questions & Answers

Bash script to insert data into an html table

hi, I need to create a bash shell script which picks up data from a text file and in the output file puts it into an html made table. I have to use sed and awk utilties to do this the input text file will contain data in the format: job name para1 para2 para3 para4 para4 1 ... (1 Reply)
Discussion started by: intern123
1 Replies

7. Shell Programming and Scripting

Read parameter file in a shell script to unload a DB2 Table???

Hi , I Have following requirement: DB2 Sql query to pass from a parameter file for example, I would create a parameter file with (SELECT column 1, column 2 FROM Table name) then job would read it and create a file with the contents named table.txt How to write/modify below ksh script to... (10 Replies)
Discussion started by: developer.dwh9
10 Replies

8. Shell Programming and Scripting

Insert script result into Oracle Table

Hi All, I want to insert STAT and ENDTIME values for each job in joblist into TBL_DAILY_STATUS table. Eg: insert into tbl_daily_status values(STAT,ENDTIME); Please help me on this. #!/bin/ksh joblist="com_abc_job com_abc_dot_job com_abc_seq com_abc_det" for i in $joblist do... (8 Replies)
Discussion started by: vichuelaa
8 Replies

9. Shell Programming and Scripting

Intelligent Script to Insert Records in Database Table

Hello All Members, I am new to this forum and to the shell scripting. I want to write a shell script to do the following: Scenario: I have a pipe delimited .txt file with multiple fields in it. The very first row of the file contains the name of the column which resembles the name of the... (18 Replies)
Discussion started by: chetanojha
18 Replies

10. Programming

How to track table status delete/update/insert status in DB2 V10 z/os?

Dear Team I am using DB2 v10 z/os database . Need expert guidance to figure out best way to track table activities ( Ex Delete, Insert,Update ) Scenario We have a table which is critical and many developer/testing team access on daily basis . We had instance where some deleted... (1 Reply)
Discussion started by: Perlbaby
1 Replies
Jifty::DBI::Handle::SQLite(3pm) 			User Contributed Perl Documentation			   Jifty::DBI::Handle::SQLite(3pm)

NAME
Jifty::DBI::Handle::SQLite -- A SQLite specific Handle object SYNOPSIS
DESCRIPTION
This module provides a subclass of Jifty::DBI::Handle that compensates for some of the idiosyncrasies of SQLite. METHODS
database_version Returns the version of the SQLite library which is used, e.g., "2.8.0". SQLite can only return short variant. insert Takes a table name as the first argument and assumes that the rest of the arguments are an array of key-value pairs to be inserted. If the insert succeeds, returns the id of the insert, otherwise, returns a Class::ReturnValue object with the error reported. case_sensitive Returns 1, since SQLite's searches are case sensitive by default. Note, however, SQLite's "like" operator is case insensitive. distinct_count STATEMENTREF takes an incomplete SQL SELECT statement and massages it to return a DISTINCT result count rename_column ( table => $table, column => $old_column, to => $new_column ) rename column AUTHOR
Jesse Vincent, jesse@fsck.com SEE ALSO
perl(1), Jifty::DBI perl v5.14.2 2010-09-21 Jifty::DBI::Handle::SQLite(3pm)
All times are GMT -4. The time now is 08:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy