Afficher un message
Vieux 03/11/2006, 19h00   #4
Stephane CHAZELAS
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Find a string with a specified number os lines

2006-11-03, 11:43(-06), Ed Morton:
[...]
>>>$ grep -L 3 file orange
>>>
>>>banana
>>>orange
>>>eggs
>>>
>>>Obviously the -L parameter doesn't exist in grep.

>>
>> [...]
>>
>> awk 'NR == 3 && /orange/' < file
>>
>> sed '3!d;/orange/!d' < file
>>

>
> I THINK what the OP wanted was to print 3 lines of context around a
> pattern, not the line that pattern is on if it's on a specific line number.


Indeed. I should get back to bed asap...

> For the OP: get GNU grep and check the man page, what you seem to want
> is already present.

[...]

Yes, and search this group archives where the question is often
asked.

--
Stéphane
  Réponse avec citation
 
Page generated in 0,04828 seconds with 9 queries