Sponsored Content
Top Forums Shell Programming and Scripting Script to Gather data from logs and export to a CSV file Post 302986326 by Yagami_Sama on Wednesday 23rd of November 2016 03:34:18 PM
Old 11-23-2016
Thank you very much for the code and sorry for the delay .

Your code is light years ahead of anything I did in awk, actually my awk knowledge is limited to “print $”.

And after a few hours trying to make your code work, unfortunately I it did not run here.
Probably I did not understand you code properly, but I am getting this :


Code:
awk: billing_errors.awk:10: awk -v PAT="$PAT" -v SERV="$SERV" -F "," '
awk: billing_errors.awk:10:           ^ syntax error
awk: billing_errors.awk:10: awk -v PAT="$PAT" -v SERV="$SERV" -F "," '
awk: billing_errors.awk:10:                          ^ syntax error
awk: billing_errors.awk:10: awk -v PAT="$PAT" -v SERV="$SERV" -F "," '

removing the ‘ from here :

Code:
awk -v PAT="$PAT" -v SERV="$SERV" -F "," '

gave another errors :

Code:
awk: billing_errors.awk:10: awk -v PAT="$PAT" -v SERV="$SERV" -F ","
awk: billing_errors.awk:10:           ^ syntax error
awk: billing_errors.awk:10: awk -v PAT="$PAT" -v SERV="$SERV" -F ","
awk: billing_errors.awk:10:                          ^ syntax error
awk: billing_errors.awk:47: } cfg FS="|" /var/log/ERROR..log > /var/report/Billing_Errors_$(date +%Y%m%d).csv
awk: billing_errors.awk:47:    ^ syntax error
awk: billing_errors.awk:47: } cfg FS="|" /var/log/ERROR..log > /var/report/Billing_Errors_$(date +%Y%m%d).csv
awk: billing_errors.awk:47:                  ^ syntax error
awk: billing_errors.awk:47: } cfg FS="|" /var/log/ERROR..log > /var/report/Billing_Errors_$(date +%Y%m%d).csv
awk: billing_errors.awk:47:                             ^ syntax error
awk: billing_errors.awk:47: } cfg FS="|" /var/log/ERROR..log > /var/report/Billing_Errors_$(date +%Y%m%d).csv
awk: billing_errors.awk:47:                                                                               ^ syntax error
awk: billing_errors.awk:47: } cfg FS="|" /var/log/ERROR..log > /var/report/Billing_Errors_$(date +%Y%m%d).csv
awk: billing_errors.awk:47:                                                                       ^ syntax error
awk: billing_errors.awk:47: } cfg FS="|" /var/log/ERROR..log > /var/report/Billing_Errors_$(date +%Y%m%d).csv
awk: billing_errors.awk:47:                                                                             ^ syntax error

I created a cfg file , following your instructions and the file is in the same path as the script.

Probably I did something wrong, but could you please advise what I did wrong and where I will inform to use the cfg file and from where it will read.

Thanks again.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

unix script to export data from csv file to oracle database

Hello people, Need favour. The problem I have is that, I need to develop a unix shell script that performs recurring exports of data from a csv file to an oracle database. Basically, the csv file contains just the first name and last name will be dumped to an Unix server. The data from these... (3 Replies)
Discussion started by: vinayagan
3 Replies

2. Shell Programming and Scripting

Shell Script to Load data into the database using a .csv file and .ctl file

Since i'm new to scripting i'm findind it difficult to code a script. The script has to be an executable with 2 paramters passed to it.The Parameters are 1. The Control file name(.ctl file) 2. The Data file name(.csv file) Does anybody have an idea about it? :confused: (3 Replies)
Discussion started by: Csmani
3 Replies

3. Shell Programming and Scripting

FTP script to gather logs.

Hi, I am currently working on a FTP script which would ftp to extranet servers from intranet server and gather logs based on timestamps in archive logs and by using a wildcard character in the present logs. I have the following in place AAA="Extranet Server 1:Instance Extranet Server... (2 Replies)
Discussion started by: openspark
2 Replies

4. Web Development

script to load data from csv file

hello i want a script to load the data line by line from a csv file into a mysql table (3 Replies)
Discussion started by: srpa01red
3 Replies

5. Shell Programming and Scripting

Exporting data as a CSV file from Unix shell script

Friends...This is the first time i am trying the report generation using shell script... any suggestions are welcome. Is there a way to set the font size & color when i am exporting the data from unix shell script as a CSV file ? The following sample data is saved as a .csv file in the... (2 Replies)
Discussion started by: appu2176
2 Replies

6. Shell Programming and Scripting

Run script to export the data to ixf file in loop

Hi, I am trying to export the data to an .ixf file. I have read the table names from a .dat file and those table name should be passed to the select * from schema.TABLENAME query . I am trying the below loop while read TABLE; do db2 EXPORT TO ~/data_export/$TABLE.ixf OF IXF MESSAGES... (5 Replies)
Discussion started by: vikyalex4
5 Replies

7. UNIX for Dummies Questions & Answers

Shell script to extract data from csv file

Hi Guys, I am new to shell script.I need your help to write a shell script. I need to write a shell script to extract data from a .csv file where columns are ',' separated. The file has 7 columns having values say column 1,column 2.....column 7 as below along with their values. Name, Address,... (7 Replies)
Discussion started by: Vivekit82
7 Replies

8. Shell Programming and Scripting

Shell script to extract data from csv file

Hi everyone, I have a csv file which has data with different heading and column names as below. Static Data Ingested ,,,,,,,,,,,,Known Explained Rejections Column_1,column_2,Column_3,Column_4,,Column_6,Column_7,,% Column_8,,Column_9 ,Column_10 ,... (14 Replies)
Discussion started by: Vivekit82
14 Replies

9. Shell Programming and Scripting

Compare 2 files of csv file and match column data and create a new csv file of them

Hi, I am newbie in shell script. I need your help to solve my problem. Firstly, I have 2 files of csv and i want to compare of the contents then the output will be written in a new csv file. File1: SourceFile,DateTimeOriginal /home/intannf/foto/IMG_0713.JPG,2015:02:17 11:14:07... (8 Replies)
Discussion started by: refrain
8 Replies

10. Linux

Parsing - export html table data as .csv file?

Hi all, Is there any out there have a brilliant idea on how to export html table data as .csv or write to txt file with separated comma and also get the filename of link from every table and put one line per rows each table. Please see the attached html and PNG of what it looks like. ... (7 Replies)
Discussion started by: lxdorney
7 Replies
IGAWK(1)							 Utility Commands							  IGAWK(1)

NAME
igawk - gawk with include files SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ... igawk [ all gawk options ] [ -- ] program-text file ... DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1). AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like @include getopt.awk in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path. OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports. EXAMPLES
cat << EOF > test.awk @include getopt.awk BEGIN { while (getopt(ARGC, ARGV, "am:q") != -1) ... } EOF igawk -f test.awk SEE ALSO
gawk(1) Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995. AUTHOR
Arnold Robbins (arnold@skeeve.com). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +--------------------+-----------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +--------------------+-----------------+ |Availability | SUNWgawk | +--------------------+-----------------+ |Interface Stability | Volatile | +--------------------+-----------------+ NOTES
Source for gawk is available on http://opensolaris.org. Free Software Foundation Nov 3 1999 IGAWK(1)
All times are GMT -4. The time now is 09:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy