Eli Fulkerson .com HomeProjectsLeak
 

leak

Leak is a unix text utility that leaks n lines of stdin to stderr before sending the rest to stdout.

In particular, this is intended when using "grep" use with commands like "df" and "ps" that include a header. By default, leak sends just the first line (the header) to stderr so that you can see it and the remainder to stdout so that grep can chew on it.

Usage:


Syntax: your_command | leak -n X -c | your_other_commands
Options:
-n X   : ignore X lines (default 1)
-c     : colorize the stderr lines
-v     : Display version information

Action Shots:


$ps |leak -c |grep bash
      PID    PPID    PGID     WINPID   TTY         UID    STIME COMMAND
    50992   49132   50992      50944  pty1        1001 15:52:27 /usr/bin/bash
    15872    6836   15872      30840  pty0        1001   Oct 30 /usr/bin/bash
    42672   15872   49736      42672  pty0        1001 15:56:00 /usr/bin/bash

$df |leak -c | grep cygdrive
Filesystem      1K-blocks      Used  Available Use% Mounted on
N:               61702208  26518080   35184128  43% /cygdrive/n
C:              487053316 380786512  106266804  79% /cygdrive/c
H:             3906983932 756543076 3150440856  20% /cygdrive/h
M:             5860389884 998796732 4861593152  18% /cygdrive/m


License:

GPLv3

Download:

leak.exe for Cygwin

leak for Linux: g++ -o leak leak.cpp

leak for OSX: g++ -o leak leak.cpp

source - leak.cpp