LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-26-2007, 05:31 PM   #16
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682

Code:
schiwalj@FAR_ADSDT1 ~
$ cat testdata
Date: 6/26/07 1:33:14 PM
LogName: NAME1
Logtype: TYPE1
LogUser: USER1
LogClient: CLIENT1
LogServer: SERVER1
LogLife: LIFE1
LogContent: CONTENT1
--
Date: 6/26/07 1:33:15 PM
LogName: NAME2
Logtype: TYPE2
LogUser: USER2
LogClient: CLIENT2
LogServer: SERVER2
LogLife: LIFE2
LogContent: CONTENT2
--
Date: 6/26/07 1:33:16 PM
LogName: NAME3
Logtype: TYPE3
LogUser: USER3
LogClient: CLIENT3
LogServer: SERVER3
LogLife: LIFE3
LogContent: CONTENT3
--
schiwalj@FAR_ADSDT1 ~
$ cat td.sed
#n
/Date:/,/--/{
              /Date:/H
              /Logtype:/H
              /LogUser:/H
              /--/{ x
                    s/^--//
                    s/^\n//
                    s/\n/ - /gp
                  }
            }


schiwalj@FAR_ADSDT1 ~
$ sed -f td.sed testdata
Date: 6/26/07 1:33:14 PM - Logtype: TYPE1 - LogUser: USER1
Date: 6/26/07 1:33:15 PM - Logtype: TYPE2 - LogUser: USER2
Date: 6/26/07 1:33:16 PM - Logtype: TYPE3 - LogUser: USER3
I'd have to break out my sed & awk book to improve on this. When I tried the 'g' instead of the 'x' command, it didn't work right, so I needed to eliminate the '--' added back to the buffer.

Last edited by jschiwal; 06-26-2007 at 05:35 PM.
 
Old 06-27-2007, 03:16 AM   #17
mfran2002
Member
 
Registered: Nov 2004
Posts: 32

Original Poster
Rep: Reputation: 15
good morning!

i tried your scripts and i've a question regarding 'Agrouf' suggestion:

my logfile is filled every minute (every minute the application takes data from db and fills logfile)
it seems that 'Agrouf' script works good only for the first filling, then it stops...

do you know why?

thanks.
 
Old 06-28-2007, 12:06 PM   #18
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,596

Rep: Reputation: 80
I suspect it because of EOF.
It is probably because the program writing to the log files closes it every time it has written to it (every minutes that is).
It would be strange because I don't think that would stop tail.
Can you try tail with -F instead of -f please?
 
Old 06-28-2007, 12:35 PM   #19
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Quote:
Originally Posted by mfran2002
it seems that 'Agrouf' script works good only for the first filling, then it stops...

do you know why?
Can you post the real script you use ?

Also, I mentioned earlier you would have buffering issues. That may be the case here.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
CPU utilization in 2.4 vs 2.6.. lynz Linux - Software 2 06-04-2007 01:40 PM
NIC utilization Mike_the_Man Linux - Networking 3 05-20-2007 05:40 PM
Help on gpg utilization Thulemanden Linux - Security 2 10-19-2005 05:30 AM
Best utilization of the channel ivanatora Linux - Networking 0 07-19-2004 01:25 PM
Memory Utilization Question toddclark Linux - General 1 11-04-2000 06:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:04 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