.. | ||
bin | ||
.gitignore | ||
.npmignore | ||
index.js | ||
package.json | ||
README.md |
SSF Command-Line Interface
ssf (SpreadSheet Format) is a pure JS library to format data using ECMA-376 spreadsheet format codes (used in popular spreadsheet software packages).
This CLI tool formats numbers from shell scripts and other command-line tools.
Installation
With npm:
$ npm install -g ssf-cli
Usage
ssf-cli
takes two arguments: the format string and the value to be formatted.
The value is formatted twice, once interpreting the value as a string and once
interpreting the value as a number, and both results are printed to standard
output, with a pipe character |
after each value:
$ bin/ssf.njs "#,##0.00" 12345
12345|12,345.00|
$ bin/ssf.njs "0;0;0;:@:" 12345
:12345:|12345|
Extracting the values in a pipeline is straightforward with AWK:
$ bin/ssf.njs "#,##0.00" 12345 | awk -F\| '{print $2}'
12,345.00
License
Please consult the attached LICENSE file for details. All rights not explicitly granted by the Apache 2.0 license are reserved by the Original Author.
Credits
Special thanks to Garrett Luu for spinning off the command from the SSF module.