You are not logged in.

#1 2012-11-09 14:00:46

Boogie
Member
Registered: 2012-06-17
Posts: 27

grep -lirn

Anyone able to help me with this -lirn arg.

-n should give me the line number, but it isnt? I am using ZSH, but i tried with regular bash but it gives me same output?

Offline

#2 2012-11-09 14:13:43

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 3,440
Website

Re: grep -lirn

It appears to be a pretty simple reason: the "-l" command will cause grep to print only the filename of a file that matches. It appears to have a higher priority than th "-n" command.

...also, using both "-l" and "-n" doesn't make much sense to me. "-l" says to only print the filename and print it only once, even if there are multiple matches in a file. If the phrase you're looking for is in the file three times, how would grep even display the matching line numbers?

Offline

#3 2012-11-09 17:29:48

Trent
Member
From: Baltimore, MD (US)
Registered: 2009-04-16
Posts: 987

Re: grep -lirn

I'm guessing you maybe copied this from somewhere and are wondering why it isn't working the same way... in which case, are you sure it's supposed to be -l (lowercase L) and not -I (uppercase i)? -I makes sense with -r because it causes grep to skip files that look like they contain binary data.

Offline

#4 2012-11-10 20:06:28

Boogie
Member
Registered: 2012-06-17
Posts: 27

Re: grep -lirn

#3 hmm i didnt copied it from anywhere.. But you gave me the correct answer.. thank you

Offline

Board footer

Powered by FluxBB