Find the answer to your Linux question:
Results 1 to 3 of 3
hello I use the programm swatch to display the syslog in a shell in realtime. Now, syslog show a lot of infos (eg. firewall-logs) which I don't want. I want ...
  1. #1
    Just Joined!
    Join Date
    Aug 2007
    Posts
    28

    pipe-filter for streams

    hello

    I use the programm swatch to display the syslog in a shell in realtime. Now, syslog show a lot of infos (eg. firewall-logs) which I don't want. I want to filter out eg. the MAC-Address etc.

    I tried this as follow:
    swatch | sed 's/MAC\=.*?\ //g'

    it seems, sed don't know not-greedy quantifiers... what should I do? I want to remove from the Word MAC all until the next whitespace...

    any hint?
    thank you.
    raphael

  2. #2
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    This is a hack, but it will work:
    Code:
    swatch | sed 's/MAC\=[^ ]*\ //g'
    If you terminate with something more complex than a single space, then you truly need non-greedy pattern matching, so (I believe) you need to punt. The following is portable in the sense that if you have Perl, then this will work for all versions of Perl:
    Code:
    swatch | perl -pe 's/MAC\=.*?\ //g'
    Hope this helps.

  3. #3
    Just Joined!
    Join Date
    Aug 2007
    Posts
    28

    Solved

    thank you very much. this is exactly what I wanted!
    greetings, raphael

Posting Permissions

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