stdin-for-each

0.0.0 • Public • Published

stdin-for-each

For each for command-line

Requirements

  • Node.js ≥ 6.0.0, and npm

Installation

npm install --global stdin-for-each

Usage

Basic

Syntax:

foo | stdin-for-each command [args]
foo | foreach command [args]
  • foo: Command that writes to stdout, e.g. cat some-file.txt, echo hello, etc.

Example:

File: input.txt

first line
second line
 
third line
 

Command:

cat input.txt | foreach bash -c 'echo ${CHUNK_INDEX}. size=$CHUNK_SIZE $CHUNK_CONTENT'

Output:

0. size=10 first line
1. size=11 second line
2. size=0
3. size=10 third line
4. size=0

Package Sidebar

Install

npm i stdin-for-each

Weekly Downloads

1

Version

0.0.0

License

MIT

Last publish

Collaborators

  • khai96_