I'm playing around with the command line. For some reason when I try to grab lines 439 - 445 the output I am getting is lines 375 - 381 instead. I use the tail command to jump to line 439 then use the head command to print only the next six lines. Those aren't the six lines I get as shown in the screenshots below.

kali > tail -n+439 /etc/snort/snort.conf | head -n 6

Screenshots: grep grabbing wrong lines

Lines 375 - 381

What's the issue?

New contributor
Dre is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • Please post text as text. – Kamil Maciorowski Dec 3 at 17:31
  • You are looking at a wrong excerpt, @Dre. The WinXP Character String that appears on the Line #445 does not appear on the Line #381. You must have bumped onto a similar excerpt. – DOBRESCU_Mihai Dec 3 at 18:01
  • Yea that's what Im sayin @DOBRESCU_Mihai – Dre Dec 3 at 18:09
  • Something is wrong, @Dre, in relation to your expectations. The grep does not select a continuous excerpt of lines, while the tail-head combination does. – DOBRESCU_Mihai Dec 3 at 18:27

nl numbers non-empty lines by default. head or tail counts all lines.

Use cat -n (option not required by POSIX), grep -n '' or nl -b a -d '' to number all lines.

  • The nl Line does not have anything to do with the tail Line, @Kamil Maciorowski. We do not know why it is still presented to us on the output. And yes, you were absolutely right, we would really be helped if we could see the Text instead of the Photographs. – DOBRESCU_Mihai Dec 3 at 18:04

Your Answer

Dre is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.