LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-20-2016, 11:47 AM   #31
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,012

Rep: Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194

It is, but I think you need to put in some of the effort to figure that out seeing you have been provided an answer. If you need details on awk you can check here
 
Old 10-20-2016, 12:02 PM   #32
dfco
LQ Newbie
 
Registered: Oct 2016
Posts: 17

Original Poster
Rep: Reputation: Disabled
@grail : your recommendation is to read the 16 chapters and the 4 appendices of the AWK user guide to find the information. Correct ?
 
Old 10-20-2016, 12:10 PM   #33
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,423
Blog Entries: 3

Rep: Reputation: 3788Reputation: 3788Reputation: 3788Reputation: 3788Reputation: 3788Reputation: 3788Reputation: 3788Reputation: 3788Reputation: 3788Reputation: 3788Reputation: 3788
Quote:
Originally Posted by dfco View Post
@grail : your recommendation is to read the 16 chapters and the 4 appendices of the AWK user guide to find the information. Correct ?
Or you could just read through the scripts you have before you to see and understand what the working parts are. The changes needed are minimal, once you know. What programming language do you have experience with already?
 
Old 10-20-2016, 12:35 PM   #34
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,921

Rep: Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016
Quote:
Originally Posted by Turbocapitalist View Post
Or you could just read through the scripts you have before you to see and understand what the working parts are. The changes needed are minimal, once you know. What programming language do you have experience with already?
I agree..the answers have been provided to the OP many times so far, with little return effort on their part. Personally, the 'where does the data come from' question still needs to be answered.

I've seen junk like this before, and while you *CAN* parse things and shovel them into a database, there are other answers that are FAR better sometimes...like using syslog-to-db programs to DIRECTLY write into a database, or being able to adjust the output logging format to give you what you want. But somehow, that question is too tough for the OP to understand (???)
 
Old 10-20-2016, 12:41 PM   #35
dfco
LQ Newbie
 
Registered: Oct 2016
Posts: 17

Original Poster
Rep: Reputation: Disabled
@TBONE. La culture, c'est comme la confiture, moins on en a, plus on l'étale.
 
Old 10-20-2016, 01:23 PM   #36
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
You already have the answer:

Code:
#Here is what is in the log file
[root@centos01 ~]# cat log.shit
SOURCE DATE Tue Oct 18 08:55:27 2016
===================================================
APP_9874 Target: CFG (Instance Name: [CFG])
APP_9889 Inserted rows - Requested: 2 Applied: 2 Rejected: 0 Affected: 2

APP_9874 Target: PORTUG_ALL (Instance Name: [PORTUG_ALL])
APP_9889 Inserted rows - Requested: 695 Applied: 695 Rejected: 0 Affected: 695
APP_9784 Updated rows - Requested: 4201 Applied: 4201 Rejected: 0 Affected: 4171

APP_9874 Target: REMOTE_DTL (Instance Name: [REMOTE_DTL])
APP_9889 Inserted rows - Requested: 1218 Applied: 1218 Rejected: 0 Affected: 1218
APP_9784 Updated rows - Requested: 2 Applied: 2 Rejected: 0 Affected: 2
APP_9784 Deleted rows - Requested: 5 Applied: 5 Rejected: 0 Affected: 3
Code:
# here is that persons awk script
[root@centos01 ~]# cat awkscript
function initialise() {
      TARGET_TABLE_NAME = "";
      INSERTED_APPLIED_ROWS = 0;
      INSERTED_AFFECTED_ROWS = 0;
      INSERTED_REJECTED_ROWS = 0;
      UPDATED_APPLIED_ROWS = 0;
      UPDATED_AFFECTED_ROWS = 0;
      UPDATED_REJECTED_ROWS = 0;
      DELETED_APPLIED_ROWS = 0;
      DELETED_AFFECTED_ROWS = 0;
      DELETED_REJECTED_ROWS = 0 }

BEGIN { initialise(); OFS="," }

$2 == "Target:"  { TARGET_TABLE_NAME = $3 }
$2 == "Inserted" { INSERTED_APPLIED_ROWS = $8;
                   INSERTED_AFFECTED_ROWS = $12;
                   INSERTED_REJECTED_ROWS = $10 }
$2 == "Updated"  { UPDATED_APPLIED_ROWS = $8;
                   UPDATED_AFFECTED_ROWS = $12;
                   UPDATED_REJECTED_ROWS = $10 }
$2 == "Deleted"  { DELETED_APPLIED_ROWS = $8;
                   DELETED_AFFECTED_ROWS = $12;
                   DELETED_REJECTED_ROWS = $10 }
/^$/ { print TARGET_TABLE_NAME,
        INSERTED_APPLIED_ROWS,INSERTED_AFFECTED_ROWS,INSERTED_REJECTED_ROWS,
        UPDATED_APPLIED_ROWS,UPDATED_AFFECTED_ROWS,UPDATED_REJECTED_ROWS,
        DELETED_APPLIED_ROWS,DELETED_AFFECTED_ROWS,DELETED_REJECTED_ROWS;
       initialise() }
Code:
#Here is the script running and output in the format requested
[root@centos01 ~]# awk -f awkscript < log.shit 
CFG,2,2,0,0,0,0,0,0,0
PORTUG_ALL,695,695,0,4201,4171,0,0,0,0
REMOTE_DTL,1218,1218,0,2,2,0,5,3,0
What else do you need?
 
2 members found this post helpful.
Old 10-20-2016, 01:50 PM   #37
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,921

Rep: Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016
Quote:
Originally Posted by dfco View Post
@TBONE. La culture, c'est comme la confiture, moins on en a, plus on l'étale.
Read the LQ Rules..post in English. And if you're just going to be snotty and not answer questions, and show no effort of your own, then do everyone a favor and post somewhere else.

Your answers, attitude, and lack of general courtesy, show how much 'culture' you have.
 
Old 10-20-2016, 01:52 PM   #38
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,921

Rep: Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016
Quote:
Originally Posted by szboardstretcher View Post
You already have the answer:

Code:
#Here is what is in the log file
[root@centos01 ~]# cat log.shit
SOURCE DATE Tue Oct 18 08:55:27 2016
===================================================
APP_9874 Target: CFG (Instance Name: [CFG])
APP_9889 Inserted rows - Requested: 2 Applied: 2 Rejected: 0 Affected: 2

APP_9874 Target: PORTUG_ALL (Instance Name: [PORTUG_ALL])
APP_9889 Inserted rows - Requested: 695 Applied: 695 Rejected: 0 Affected: 695
APP_9784 Updated rows - Requested: 4201 Applied: 4201 Rejected: 0 Affected: 4171

APP_9874 Target: REMOTE_DTL (Instance Name: [REMOTE_DTL])
APP_9889 Inserted rows - Requested: 1218 Applied: 1218 Rejected: 0 Affected: 1218
APP_9784 Updated rows - Requested: 2 Applied: 2 Rejected: 0 Affected: 2
APP_9784 Deleted rows - Requested: 5 Applied: 5 Rejected: 0 Affected: 3
Code:
# here is that persons awk script
[root@centos01 ~]# cat awkscript
function initialise() {
      TARGET_TABLE_NAME = "";
      INSERTED_APPLIED_ROWS = 0;
      INSERTED_AFFECTED_ROWS = 0;
      INSERTED_REJECTED_ROWS = 0;
      UPDATED_APPLIED_ROWS = 0;
      UPDATED_AFFECTED_ROWS = 0;
      UPDATED_REJECTED_ROWS = 0;
      DELETED_APPLIED_ROWS = 0;
      DELETED_AFFECTED_ROWS = 0;
      DELETED_REJECTED_ROWS = 0 }

BEGIN { initialise(); OFS="," }

$2 == "Target:"  { TARGET_TABLE_NAME = $3 }
$2 == "Inserted" { INSERTED_APPLIED_ROWS = $8;
                   INSERTED_AFFECTED_ROWS = $12;
                   INSERTED_REJECTED_ROWS = $10 }
$2 == "Updated"  { UPDATED_APPLIED_ROWS = $8;
                   UPDATED_AFFECTED_ROWS = $12;
                   UPDATED_REJECTED_ROWS = $10 }
$2 == "Deleted"  { DELETED_APPLIED_ROWS = $8;
                   DELETED_AFFECTED_ROWS = $12;
                   DELETED_REJECTED_ROWS = $10 }
/^$/ { print TARGET_TABLE_NAME,
        INSERTED_APPLIED_ROWS,INSERTED_AFFECTED_ROWS,INSERTED_REJECTED_ROWS,
        UPDATED_APPLIED_ROWS,UPDATED_AFFECTED_ROWS,UPDATED_REJECTED_ROWS,
        DELETED_APPLIED_ROWS,DELETED_AFFECTED_ROWS,DELETED_REJECTED_ROWS;
       initialise() }
Code:
#Here is the script running and output in the format requested
[root@centos01 ~]# awk -f awkscript < log.shit 
CFG,2,2,0,0,0,0,0,0,0
PORTUG_ALL,695,695,0,4201,4171,0,0,0,0
REMOTE_DTL,1218,1218,0,2,2,0,5,3,0
What else do you need?
Obviously, someone to write it, document it, and implement it for him at this point. Don't know why they elected to be snotty and not answer questions, then act surprised when they get no further help.

I was polite in my very first reply, which was totally ignored, and others have also asked the OP questions with no response. So it seems like another person looking for a handout.
 
Old 10-20-2016, 01:56 PM   #39
dfco
LQ Newbie
 
Registered: Oct 2016
Posts: 17

Original Poster
Rep: Reputation: Disabled
@szboardstretcher: Thanks a lot for your update. I am studying the code and trying to understand.
 
Old 10-20-2016, 02:05 PM   #40
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,012

Rep: Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194
Quote:
Originally Posted by dfco View Post
@grail : your recommendation is to read the 16 chapters and the 4 appendices of the AWK user guide to find the information. Correct ?
Actually, yes if that is what it takes because you cannot see any obvious links that might lead you to the answer.
You seemed to be very ready to get upset at TBOne's requests for information and the fact that he has simply pointed out rules and LQ etiquette. I am starting to agree that
if you are unwilling to put any effort at all into learning a solution, that you apparently want to run in a production environment, maybe you would be better off asking your
questions directly to Oracle whom your company would be paying for solutions.

You seem to be under the assumption that the users here work for you and are required to not only come up with a solution but when it does not perform to your liking, they
are also required to make any and all adjustments / edits so it works as you like. It would be funny if your employer was a member so he / she can maybe see that you are not anywhere as skilled as you are pretending to be.
 
2 members found this post helpful.
Old 10-20-2016, 03:44 PM   #41
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,921

Rep: Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016
Quote:
Originally Posted by grail View Post
Actually, yes if that is what it takes because you cannot see any obvious links that might lead you to the answer.
You seemed to be very ready to get upset at TBOne's requests for information and the fact that he has simply pointed out rules and LQ etiquette. I am starting to agree that
if you are unwilling to put any effort at all into learning a solution, that you apparently want to run in a production environment, maybe you would be better off asking your
questions directly to Oracle whom your company would be paying for solutions.

You seem to be under the assumption that the users here work for you and are required to not only come up with a solution but when it does not perform to your liking, they
are also required to make any and all adjustments / edits so it works as you like. It would be funny if your employer was a member so he / she can maybe see that you are not anywhere as skilled as you are pretending to be.
Agreed totally. My first post was fairly polite, and simply asked the OP questions:
Quote:
Originally Posted by TB0ne
Please read the "Question Guidelines" link in my posting signature. Without knowing what you have done/tried or you posting your actual code, we can't tell you much. You say "tried many options", but don't tell us WHICH ONES, or give us details about what your actual goal is, or how often you need to do this. Solutions for a one-time fix will be different than something that's meant to be run numerous times a week/day.

Also, where is this data coming FROM? Could be there is already an option to save it in CSV format the way you want it.
Have *NO IDEA* why someone would get snotty and sarcastic from that. OP showed no work of their own, or provided any info, and it took until post #15 before they even bothered mentioning ODI, despite being asked things three times before that.
 
Old 10-22-2016, 10:20 AM   #42
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
PLEASE come back to the subject and be friendly to each other. This is what LQ is about, isn't it?
 
Old 10-22-2016, 01:10 PM   #43
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,921

Rep: Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016Reputation: 8016
Quote:
Originally Posted by Mara View Post
PLEASE come back to the subject and be friendly to each other. This is what LQ is about, isn't it?
Apparently not, since my very first post started with "Please" and asked for more information, with the rationale behind asking. Can you explain why the OP was so snotty and sarcastic??
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with parsing log file sysmicuser Linux - Newbie 5 03-10-2012 05:50 PM
Script for parsing a log file pepepapa82 Linux - Newbie 3 10-04-2011 01:24 AM
Parsing log file with awk sebelk Programming 1 08-31-2009 08:47 AM
Parsing a log file jpostma Linux - Newbie 5 12-05-2008 03:58 PM
Help on parsing a log file in BASH globemast Programming 5 01-11-2007 01:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration