Find the answer to your Linux question:
Results 1 to 5 of 5
Hello, I am able to capture a snap shot of a log file on a consumer device. This log comes in the form of a HTML page and contains time ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2004
    Posts
    3

    trying to write script for sdiff to merge log files


    Hello,

    I am able to capture a snap shot of a log file on a consumer device. This log comes in the form of a HTML page and contains time stamps.

    My first script will take the snapshot of the log every 10 seconds.

    I then need to merge the files to create a complete log file.

    Currently I am using the following in a new script

    sdiff -o output.file -s first_log.file second_log.file

    When there are only a few files to merge, it's easy, but when I have twenty to thirty, that is where I run into diffculty. It's easy to make a mistake and have to start over.

    Notes : since all lines contain a time stamp, using sdiff, all lines displayed are considered unique.

    Should I just use diff instead of sdiff? Or another commands all together?

    Any suggestions would be appreciated.

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    I don't really understand the situation - how could you get twenty to thirty different log files from one device?

    Also, what are you trying to do really? Create a continuous text format log file?

    It seems to me that the easiest way to do this would be to write a perl script that finds the lines and timestamps and merges everything.

  3. #3
    Just Joined!
    Join Date
    Jun 2004
    Posts
    3
    I am working on a consumer electronic device. This device will post a bottom fraction of the log file in the form of a web page.

    Someone has already created a script to use "wget" to capture this log file.

    In my testing I need to peform many steps to duplicate some of these bugs. Thus a lot of log information will be displayed. This can take several minutes, and thus I may end up with twenty or thirty snapshots of the log file.

    I want to submit a continous log file with each bug report, and that is why I am using sdiff to splice them together. The timestamps make the lines unique.

    Currently I don't know PERL, so I have just been using schell scripts for now.

    Thanks in advance

  4. #4
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Can you post a sample of such a snapshot? It would be a lot easier if we knew what the HTML looks like.

  5. #5
    Just Joined!
    Join Date
    Jun 2004
    Posts
    3
    You would see 1400 lines of the sample below

    you can see the time stamps as follows 20040622164519.751743


    <span style="color: rgb(255,180,0);">PVR-ViewerRecorder-WARNING (20040622164519.751743)[THREAD:33823]</span>vr__run: Waiting for message

    <span style="color: rgb(255,180,0);">PVR-ViewerRecorder-WARNING (20040622164519.760305)[THREAD:39972]</span>vr__run: Waiting for message

    <span style="color: rgb(51,102,255);">edge-DEBUG (20040622164520.608606)[THREAD:34848]</span>sending recorder update

    <span style="color: rgb(51,102,255);">edge-DEBUG (20040622164520.608805)[THREAD:34848]</span>finished recorder update

    <span style="color: rgb(255,180,0);">PVR-ViewerRecorder-WARNING (20040622164520.608882)[THREAD:34848]</span>vr__dec_ref: refcount going from 2 to 1

    <span style="color: rgb(255,180,0);">PVR-ViewerRecorder-WARNING (20040622164520.608999)[THREAD:39972]</span>vr__run: received system event

    <span style="color: rgb(255,180,0);">PVR-ViewerRecorder-WARNING (20040622164520.609393)[THREAD:39972]</span>Reading from 755183632 (0) to 755649792 (91

    <span style="color: rgb(51,102,255);">edge-DEBUG (20040622164520.619545)[THREAD:34848]</span>sending recorder update

    <span style="color: rgb(51,102,255);">edge-DEBUG (20040622164520.61975[THREAD:34848]</span>finished recorder update

    <span style="color: rgb(255,180,0);">PVR-ViewerRecorder-WARNING (20040622164520.619834)[THREAD:34848]</span>vr__dec_ref: refcount going from 6 to 5

    <span style="color: rgb(51,102,255);">edge-DEBUG (20040622164520.61994[THREAD:3076]</span>sending recorder update

    <span style="color: rgb(51,102,255);">edge-DEBUG (20040622164520.620031)[THREAD:3076]</span>finished recorder update

    <span style="color: rgb(255,180,0);">PVR-ViewerRecorder-WARNING (20040622164520.620100)[THREAD:3076]</span>vr__dec_ref: refcount going from 5 to 4

    <span style="color: rgb(51,102,255);">edge-DEBUG (20040622164520.620199)[THREAD:5126]</span>sending recorder update

    <span style="color: rgb(51,102,255);">edge-DEBUG (20040622164520.620285)[THREAD:5126]</span>finished recorder update

    <span style="color: rgb(255,180,0);">PVR-ViewerRecorder-WARNING (20040622164520.620353)[THREAD:5126]</span>vr__dec_ref: refcount going from 4 to 3

    <span style="color: rgb(51,102,255);">edge-DEBUG (20040622164520.620461)[THREAD:10251]</span>sending recorder update

    <span style="color: rgb(51,102,255);">edge-DEBUG (20040622164520.620546)[THREAD:10251]</span>finished recorder update

    <span style="color: rgb(255,180,0);">PVR-ViewerRecorder-WARNING (20040622164520.620613)[THREAD:10251]</span>vr__dec_ref: refcount going from 3 to 2

    <span style="color: rgb(51,102,255);">edge-DEBUG (20040622164520.620716)[THREAD:9226]</span>sending recorder update

    <span style="color: rgb(51,102,255);">edge-DEBUG (20040622164520.620800)[THREAD:9226]</span>finished recorder update

    <span style="color: rgb(255,180,0);">PVR-ViewerRecorder-WARNING (20040622164520.620869)[THREAD:9226]</span>vr__dec_ref: refcount going from 2 to 1

    <span style="color: rgb(255,180,0);">PVR-ViewerRecorder-WARNING (20040622164520.620981)[THREAD:33823]</span>vr__run: received system event

    <span style="color: rgb(255,180,0);">PVR-ViewerRecorder-WARNING (20040622164520.621749)[THREAD:33823]</span>Reading from 2246272844 (-14)


    currently I am using sdiff -o output.file -s input1.file input2.file

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •