Socket
Socket
Sign inDemoInstall

cut-ordered

Package Overview
Dependencies
9
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cut-ordered

Like unix's cut(1) except columns can be reordered, and within ~1.3x speed.


Version published
Maintainers
1
Install size
400 kB
Created

Readme

Source

cut-ordered

Like a cut(1) that allows reordering of fields.

UNIX cut(1) is a great utility, but I found myself wanting to often reorder fields. This cmd utility attempts to be similar in terms of API to cut(1) but respects the given column order. This is especially useful when wanting to sort data numerically.

Usage

npm install -g cut-ordered
echo 'a b c' | cut-ordered -f 3,2,1 -d ' '
c b a
echo 'a b c' | cut-ordered -f 3,1 -d ' '
c a

Benchmarking

The line parser is a custom compiled function: while gross-looking this means it should execute as quickly as possible (currently about 1.3x as slow as cut(1)). To compare the two:

npm run bench
...

cut

real  0m5.698s
user  0m5.366s
sys 0m0.133s

cut-ordered

real  0m7.646s
user  0m6.717s
sys 0m0.873s

License

MIT

Keywords

FAQs

Last updated on 17 Apr 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc