Results 1 to 3 of 3

Thread: Need some help reading part of a log file...

  1. #1
    Join Date
    Jul 2010
    Posts
    2

    Need some help reading part of a log file...

    Hello.

    I have a problem with reading a log file the way I want to.

    I have many systems reporting errors to a file called "error.log" in a "main" system.
    Only two of the systems in the file concerns me. (sys1 and sys2.)
    To read the messages for the two systems I use the command:
    Code:
    tail -f error.log | egrep 'sys1'|'sys2'
    This gives me only the information about sys1 and sys2.
    However, this also gives me more information than I'd like.
    Example of information given:
    sys1 cooling warning
    sys2 door open
    sys2 cooling error
    sys1 lost connection with hhut1
    sys1 gained connection with hhut1
    sys2 door closed

    Lets say I want to exclude the information about cooling and door. My idea was to use this command:
    Code:
    tail -f error.log | egrep 'sys1|sys2' | egrep -v 'cooling|door'
    My guess is that you know this does not work. I also guess that you know why.

    Any one that care to help me out?

  2. #2
    Join Date
    Mar 2010
    Posts
    20

    Re: Need some help reading part of a log file...

    Have you tried using sed:

    Code:
    tail -f error.log | sed -nr '/door|cooling/ d ; /sys1|sys2/ p'
    Or try to flush the output from grep to let it pass through the second pipe:

    Code:
    error.log | grep -E --line-buffered 'sys1|sys2' | grep -E -v 'cooling|door'

  3. #3
    Join Date
    Jul 2010
    Posts
    2

    Re: Need some help reading part of a log file...

    This works:
    Code:
    tail -f error.log | sed -nr '/door|cooling/ d ; /sys1|sys2/ p'
    This does NOT work: (not for me anyway)
    Code:
    tail -f error.log | grep -E --line-buffered 'sys1|sys2' | grep -E -v 'cooling|door'

    Thanks.

Similar Threads

  1. How to cut the few seconds of part from the m4v file?
    By ROcHANn in forum Windows Software
    Replies: 5
    Last Post: 01-07-2011, 10:03 PM
  2. Copying Of the Readable Part Of The File In The Disc
    By Ossi in forum Hardware Peripherals
    Replies: 3
    Last Post: 03-12-2010, 06:42 AM
  3. Download specific part of file from Torrent
    By Asis in forum Technology & Internet
    Replies: 6
    Last Post: 25-06-2010, 04:07 AM
  4. Reading file bit by bit
    By John Wilson in forum Software Development
    Replies: 4
    Last Post: 14-12-2009, 01:49 PM
  5. VOB editor needed to delete part of a file
    By Arif15 in forum Windows Software
    Replies: 3
    Last Post: 13-06-2009, 05:37 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,191,270.68267 seconds with 17 queries