Sponsored Content
Top Forums Shell Programming and Scripting How to log file processing details to database table usnig UNIX shell script? Post 302967170 by balajesuri on Saturday 20th of February 2016 11:56:47 AM
Old 02-20-2016
Code:
file_list=( $(find . -maxdepth 1 -type f) )
file_count=${#file_list[@]}

echo "Number of files: $file_count"
for file in ${file_list[@]}
do
    line_count=1
    while read line
    do
        process_line line
        (( line_count++ ))
    done < $file
    echo "Number of lines processed in $file: $line_count"
done

 

10 More Discussions You Might Find Interesting

1. Programming

how to diplay the file details on terminal in table format

hi all i want to display the details of text files on terminal in table format as JobID SubmissionTime ExecutionTime CompletionTime Status Server Machine user_1 00:00:00 00:00:00 ... (1 Reply)
Discussion started by: nitya2025
1 Replies

2. Shell Programming and Scripting

How to connect to database db2 through Unix Shell Script

I am trying to connect to database db2 through shell script. The process I am trying is > db2 It gives me error Access Denied. While checking for access I have the rights. Is there ant other way round..? Please help. (3 Replies)
Discussion started by: ankitgupta
3 Replies

3. Shell Programming and Scripting

what is uses of unix shell script in database projects

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (2 Replies)
Discussion started by: alokjyotibal
2 Replies

4. UNIX for Dummies Questions & Answers

Script for parsing details in a log file to a seperate file

Hi Experts, Im a new bee for scripting, I would ned to do the following via linux shell scripting, I have an application which throws a log file, on each action of a particular work with the application, as sson as the action is done, the log file would vanish or stops updating there, the... (2 Replies)
Discussion started by: pingnagan
2 Replies

5. UNIX for Dummies Questions & Answers

Shell Script: Traverse Database Table Row by Row

Hello Everyone, My issue is that I want to traverse a database table row by row and do some action on the value retrieved in each row. I have gone through a lot of shell script questions/posts. I could find row by row traversal of a file but not a database table. Please help. Thanks &... (5 Replies)
Discussion started by: ahsan.asghar
5 Replies

6. UNIX for Dummies Questions & Answers

How to Update DB table from txt file using CRONJOB in Unix Shell Script

Hi Experts, can guide how we can Update a Database Table using a txt file source Using Unix Shell Scripts. What are the Cron Jobs codes can written to Update DB table. txt file contains record like data. US 09/03/2012 User DocType DocID. these above feilds in txt files need to be updated in... (4 Replies)
Discussion started by: mahesh.sap
4 Replies

7. Programming

awk processing / Shell Script Processing to remove columns text file

Hello, I extracted a list of files in a directory with the command ls . However this is not my computer, so the ls functionality has been revamped so that it gives the filesizes in front like this : This is the output of ls command : I stored the output in a file filelist 1.1M... (5 Replies)
Discussion started by: ajayram
5 Replies

8. Shell Programming and Scripting

Is it possible to get the database details in UNIX?

Hi, Sorry i can't find what particular forum should i post my question. I was given a username and password for the database, but i was not given the hostname, SID and the port to were i can connect to with. Is there a way for me to get the following details in unix, by the way i am using... (5 Replies)
Discussion started by: reignangel2003
5 Replies

9. Shell Programming and Scripting

Download a db table through UNIX shell script

Hi, I'm an amateur and need your help in figuring this out. I have been asked to connect to a prod db from non-prod env., and download a table from prod db to non-prod env. I was able to connect to the prod db and then run a simple query as below. @@@@@@@@@@ ... (7 Replies)
Discussion started by: arunpvp
7 Replies

10. UNIX for Beginners Questions & Answers

Generic script to load file details(ls -ltr) in to a database.

All, I am trying to create a report on the duration of an ETL load from the file arrival to the final dump in to a database for SLA's. Does anyone have any guidance or ideas on how metadata can be extracted; information of a file: like file name, created timestamp, count of records and load... (1 Reply)
Discussion started by: pradeepp
1 Replies
DlfConverterProcess(3pm)				  LogReport's Lire Documentation				  DlfConverterProcess(3pm)

NAME
Lire::DlfConverterProcess - Object that controls the DLF conversion process SYNOPSIS
use Lire::ImportJob; use Lire::DlfStore; use Lire::DlfConverterProcess; my $src = new Lire::ImportJob( "file", 'pattern' => "/var/log/messages" ); my $store = Lire::DlfStore->open( "store" ); my $process = new Lire::DlfConverterProcess( $src, $store ); $process->run_import_job(); print "Log lines read: ", $process->line_count(), " "; print "DLF records created: ", $process->dlf_count, " "; print "Errors encountered: ", $process->errors_count, " "; print "Ignored records: ", $process->ignored_count," "; DESCRIPTION
This object encapsulates the Lire DLF conversion process. It takes as parameter a Lire::ImportJob and a Lire::DlfStore. It will setup the converter and will converter the content of Lire::ImportJob to DLF which will be saved in the Lire::DlfStore. The object provides the API to the converter. Methods are also available to query information on the conversion process. new( $job, $store ); Create a Lire::DlfConverterProcess that will be used to import the log specified in Lire::ImportJob into DLF records which will be stored into Lire::DlfStore. run_import_job( [$time] ) Import the log data from ImportJob as DLF. This method will throw an exception if it is called more than once. The $time parameter will be used to determine the time window covered by period. It defaults to the current time. job_id() Returns the job identifier associated to this process. dlf_store() Returns the Lire::DlfStore in which this conversion process is storing the DLF records. import_job() Returns the Lire::ImportJob upon which this conversion process is operating. line_count() Returns the number of lines processed. This will 0 in case the DLF converter process file and not log lines. During a processing, this is always equals to the line that is currently being converted. dlf_count() Returns the number of DLF records created. error_count() Returns the number of errors encountered in the conversion process. ignored_count() Returns the number of records which were ignored in the conversion process. saved_count() Returns the number of lines which were saved for later processing. API FOR THE DLF CONVERTERS
This is the object that encapsulates the Dlf implementation and hides the complexitity of the storage framework from the DLF converter. It offers the following methods to the DLf converter. write_dlf( $schema, $dlf ) This writes the $dlf DLF record conforming the $schema's schema in the Lire::DlfStore. The schema is the schema's name (e.g. 'www'). $dlf is an hash reference. Keys are the schema's field name. Undefined value means that this field isn't available in that record. save_log_line( $line ) Method that should be used to save $line for a future processing run of the converter on the same Lire::ImportJob. ignored_log_line( $line, [ $reason ] ) Method that can be used by the Lire::DlfConverter to report that the '$line' log line was ignored during that processing. The reason why the line was ignored can be given in $reason. For example, syslog-based converter should use that method to report lines that are for another 'service' than theirs. error( $error_msg, [ $line ] ); Method that should be used by the Lire::DlfConveter to report that an error was encountered when processing the Lire::ImportJob. $error_msg should be used to report the nature of the error. The $line parameter should be used by converter operating on lines to associate the error message to a particular line. SEE ALSO
Lire::DlfStore(3pm) Lire::DlfConverter(3pm) AUTHOR
Francis J. Lacoste <flacoste@logreport.org> VERSION
$Id: DlfConverterProcess.pm,v 1.18 2006/07/23 13:16:28 vanbaal Exp $ COPYRIGHT
Copyright (C) 2002-2004 Stichting LogReport Foundation LogReport@LogReport.org This file is part of Lire. Lire is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (see COPYING); if not, check with http://www.gnu.org/copyleft/gpl.html. Lire 2.1.1 2006-07-23 DlfConverterProcess(3pm)
All times are GMT -4. The time now is 06:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy