Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2006
    Posts
    1,111

    Linux get last line of output

    Hi

    What command could I use to get the last line of an output?

    Heres why...

    I use this command:

    Code:
    netstat -plan|grep :80|awk {'print $5'}|cut -d: -f 1|sort|uniq -c|sort -nk 1
    I would like to get just the last line of the output, the output looks like this:

    Code:
    1 203.118.105.*
    1 80.195.165.*
    1 87.211.51.*
    1 91.40.90.*
    8 82.2.222.*
    213
    The reason is because I'd like to get that last figure to place into a file on a certain time period (through a cron), which will then be graphed with PHP.

    Thanks!

  2. #2
    Join Date
    Apr 2005
    Location
    Cochin
    Posts
    2,446
    netstat -plan|grep :80|awk {'print $5'}|cut -d: -f 1|sort|uniq -c|sort -nk 1 | tail -1
    Sam
    Supportlobby.com - Expertise in Windows/Linux server support, IaaS and PaaS Management
    Spiralbean.com - Custom Software Development
    Email: exec @ activelobby.net | Skype: unni_active

  3. #3
    Join Date
    Jun 2006
    Posts
    1,111
    Thanks very much!

    To be honest, I should of thought of that myself. "tail" is one of the very few commands(?) I know in Linux!

    Again though, thanks alot

  4. #4
    Join Date
    Apr 2005
    Location
    Cochin
    Posts
    2,446
    Quote Originally Posted by ST-Mike View Post
    Thanks very much!

    To be honest, I should of thought of that myself. "tail" is one of the very few commands(?) I know in Linux!

    Again though, thanks alot

    Take care Mike
    Sam
    Supportlobby.com - Expertise in Windows/Linux server support, IaaS and PaaS Management
    Spiralbean.com - Custom Software Development
    Email: exec @ activelobby.net | Skype: unni_active

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •