grep stop working?

Discussion in 'Linux Beginners' started by pecka33, Sep 14, 2021.

  1. pecka33

    pecka33 Member

    Hello,

    i am using debian 11 with ispconfig latest version. Always i used command for example like this
    sudo cat /var/log/mail.log | grep message-id
    and works fine, today morning too. I didnt do any changes with my vps. When i login before few minutes, when i do this, i can see latest log from this morning (but email was sent few minutes ago and when i open file, i can see there)

    i get error
    grep: (standard input): binary file matches

    Any idea why?
     
  2. pecka33

    pecka33 Member

    I found that in some files i can use grep fine, but for example in this mail log not. Maybe there are wrong characters?
     
  3. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    Yep; check the man page to see if there is a switch to treat it as plain text regardless of hanging those characters.
     
  4. pecka33

    pecka33 Member

    Thanks. I used command
    Code:
    sudo cat /var/log/mail.log | grep message-id -a
    
    and works fine.
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    Btw, you don't have to use cat command and pipe as the grep command can read files on it's own:

    Code:
    sudo grep -a message-id /var/log/mail.log
     
    pecka33 likes this.

Share This Page