http://www.perlmonks.org?node_id=855526


in reply to Re^3: what is grep command for and condition
in thread OT: what is grep command for and condition

This node falls below the community's threshold of quality. You may see it by logging in.
  • Comment on Re^4: what is grep command for and condition

Replies are listed 'Best First'.
Re^5: what is grep command for and condition
by ikegami (Patriarch) on Aug 17, 2010 at 15:40 UTC

    Please use <c>...</c> around computer text (data, code, output, etc).

    [17/Aug/2010:14:58:39 +0000] conn=102837 op=0 msgId=13496 - MOD xxxxxx +xx [17/Aug/2010:15:27:16 +0000] conn=102837 op=0 msgId=21769 - DEL xxxxxx

    i just want to grep all the lines with the word "MOD" and "DEL" from the tail command ..can you help me?

    You just said your file had no such line. It sounds like you want to keep all the lines that have the word "MOD" or the word "DEL". You already posted code to do that.

Re^5: what is grep command for and condition
by JavaFan (Canon) on Aug 17, 2010 at 18:08 UTC
    If you don't have any lines that contain both MOD and DEL in your file, then grep MOD | grep DEL not printing anything seems quite correct to me.

    Let me ask it this way, given the file with no lines containing MOD and DEL, which lines do you want to have printed?