0

I have a log file that I pull data to a private web page to monitor my router. There are alot of entries. for each access control list. right now I have a simple php script. I only want the last 12 entries of the grep iWiSP-In. There could be 100's of them in the file. using Tail -n XX in place of cat won't work since there may not be any entries in that time frame. There has to be simple answer that is escaping me.

<?php
$output = shell_exec('cat /var/log/_gateway-syslog.log | grep iWiSP-In');
echo "<pre>$output</pre>";
?>
  • 1
    tail after grep? grep iWiSP-In /var/log/_gateway-syslog.log | tail -n 12 – steeldriver Jul 6 at 12:27
  • That did it. I had tried several variations and it didn't work. I know it was something simple . Thank you steeldriver – ml41782 Jul 6 at 13:20

Your Answer

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

Browse other questions tagged or ask your own question.