Coder Social home page Coder Social logo

thepipe's Introduction

Table Header Excluded Pipe

When you pipe stdout of some command to another one, every line is fed to the latter. If the output of the first one is a table, its first line (the header) is processed by the second command along with the table content, which is frequently not the desired behavior.

Table Header Excluded Pipe (thepipe) echoes the first line of stdin received from somewhere as is and pipes the rest of the input to the child command, as the usual pipe does, for example:

$ ps | thepipe sed 's!pts/!!'
    PID TTY          TIME CMD
  14107 5    00:00:00 bash
  14128 5    00:00:00 ps
  14129 5    00:00:00 thepipe
  14130 5    00:00:00 thepipe

The table header stays untouched while the table content is processed through sed.

Given that the most frequent use of this tool is filtering the content of the table with grep, there is a wrapper thegrep, which does exactly what thepipe grep would do:

$ docker images | thegrep postgres
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
postgres            latest              c96f8b6bc0d9        2 weeks ago         314MB

Build

To build thepipe you need a Rust toolchain.

Once you have it on your machine, you can build thepipe by running

cargo build --release

The resulting binary is target/release/thepipe.

To install it into your system, run

sudo ./install

This will place thepipe and thegrep into your /usr/bin.

thepipe's People

Contributors

qazerlab avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.