Skip to content
/ dashn Public

From the command line, run code for every line in some text.

License

Notifications You must be signed in to change notification settings

psalaets/dashn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dashn

From the command line, run code for every line in some text.

Roughly equivalent to ruby -ne '<code>' file1 … filen.

Usage

Read from files

dashn '<code>' file1 … filen

Read from stdin

cat a.txt | dashn '<code>'

Free Variables

<code> can reference any of the following:

line (String) - Current line of input. Trailing newline has been stripped.

num (Number) - Current line number of input. Starts at 1.

log (Function) - Alias for console.log.

error (Function) - Alias for console.error.

Example

Given file a.txt containing

dog
cat
house

Running

dashn 'log(line.toUpperCase())' a.txt

prints

DOG
CAT
HOUSE

Installation

npm install -g dashn

License

MIT

About

From the command line, run code for every line in some text.

Resources

License

Stars

Watchers

Forks

Packages

No packages published