Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 3442effdb9
Fetching contributors…

Cannot retrieve contributors at this time

executable file 27 lines (23 sloc) 0.604 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#!/usr/bin/env perl
use App::Cope;
use App::Cope::Extra qw[user nonzero];

my @headers = qw[type port inode uid pid fd name];

sub process {
  if (/^type/) {
    for my $h (@headers) {
      mark $h => 'underline';
    }
  }

  else {
    line qr{^
(tcp|udp|raw) \s+ # type
(\d+) \s+ # port
(\d+) \s+ # inode
(\d+) \s+ # uid
(\d+) \s+ # pid
(\d+) # fd
}x => { tcp => 'magenta bold', udp => 'red bold', raw => 'red' },
'green bold', 'green', \&{ user 'yellow' }, 'cyan', 'blue';
  }
}

run( \&process, real_path, @ARGV );
Something went wrong with that request. Please try again.