When using the following command:
nl /etc/snort/snort.conf | grep output
I get the following output:
33 # 6) Configure output plugins
445 # Step #6: Configure output plugins
450 # output unified2: filename snort.log, limit 128, mpls_event_types, vlan_event_types
So, I can see that Step #6: Configure output plugins
is on line 445.
I want to output line 445 plus the previous five lines (440-444 + 445), so I use:
tail -n+440 /etc/snort/snort.conf | head -n 6
However, this gives me completely different results. So, I cat the entire file with line numbers, investigate and indeed see that the line # Step #6: Configure output plugins
is on line 445...
After much trial and error with the tail command, I finally get my intended results, however the line that I originally thought was on 445 is actually on 529. I can verify this by altering the previous command numbers to:
tail -n+524 /etc/snort/snort.conf | head -n 6
I then get the originally expected results, showing five lines of the config files, with # Step #6: Configure output plugins
as the last line of the output.
Why is there a discrepancy between the perceived line numbers (445 vs 529)?