https://github.com/ksxnodeapps/stdin-for-each
For each for command-line
https://github.com/ksxnodeapps/stdin-for-each
Last synced: 7 months ago
JSON representation
For each for command-line
- Host: GitHub
- URL: https://github.com/ksxnodeapps/stdin-for-each
- Owner: ksxnodeapps
- License: mit
- Created: 2017-06-07T10:14:08.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-01-23T09:46:54.000Z (over 8 years ago)
- Last Synced: 2024-04-24T15:45:15.610Z (about 2 years ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/stdin-for-each
- Size: 30.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# stdin-for-each
For each for command-line
## Requirements
* Node.js ≥ 6.0.0, and npm
## Installation
```bash
npm install --global stdin-for-each
```
## Usage
### Basic
**Syntax:**
```bash
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`
```text
first line
second line
third line
```
_Command:_
```bash
cat input.txt | foreach bash -c 'echo ${CHUNK_INDEX}. size=$CHUNK_SIZE $CHUNK_CONTENT'
```
_Output:_
```text
0. size=10 first line
1. size=11 second line
2. size=0
3. size=10 third line
4. size=0
```