Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: what is grep command for and condition

by anakin30 (Acolyte)
on Aug 17, 2010 at 15:17 UTC ( #855523=note: print w/ replies, xml ) Need Help??


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

i executed this command below: tail -f access | grep -i "MOD" | grep -i "DEL" it's not working.. anyway thanks for your response...


Comment on Re^2: what is grep command for and condition
Re^3: what is grep command for and condition
by toolic (Chancellor) on Aug 17, 2010 at 15:22 UTC
    Firstly, you replied to the wrong node. You should have replied to moritz's node.

    Secondly, that looks like correct grep syntax to me. I bet that your 'access' file does not have a line with both MOD and DEL in it, something like:

    foo DEL bar MOD goo

      Firstly i'm so sorry to reply you wrongly. yeah my access file doesn't have a line both with MOD and DEL. 17/Aug/2010:14:58:39 +0000 conn=102837 op=0 msgId=13496 - MOD xxxxxxxx 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?

        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.

        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?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://855523]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (9)
As of 2014-10-31 12:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (217 votes), past polls