npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

grp-cli

v0.1.4

Published

Unix CLI that facilitates breaking text into groups of characters.

Downloads

8

Readme

npm version license

Contents

grp — Introduction

grp is a Unix CLI that facilitates breaking text into groups of characters with a variety of options and also offers formatting numbers with digit grouping (thousands separators) based on the active locale.

See the examples below, concise usage information further below, or read the manual.

Examples

  # By default, break a string into space-separated groups of 3 chars.,
  # starting from the right (end).
$ grp 1000000 2000
1 000 000 
2 000

  # Use proper number formatting (separation with locale-specific thousands
  # separators) with -n; example output from the U.S. English locale:
$ grp -n 1000000 1999.99
1,000,000
1,999.99
  
   # Break input into lines of 3 characters each, starting from the left:
$ grp -c 3 -s $'\n' -l abcdefgh
abc
def
gh

   # Insert a '.' between characters:
$ grp -c 1 -s . abcdef
a.b.c.d.e.f

   # Enclose each character in square brackets:
$ grp -c 1 -f '[%s]' abc
[a][b][c]

   # Format text as a US telephone number:
$ echo '6085277865' | grp -f '+1 (%s) %s-%s' -c 3,3,4 
+1 (608) 527-7865

  # Break the input into repeating groups of 2 and 1 char. each:
$ grp -l -c 2,1+ -s / abcdefgh
ab/c/de/f/gh

Installation

Supported platforms

  • When installing from the npm registry: Linux and OSX
  • When installing manually: any Unix-like platform with Bash

From the npm registry

With Node.js or io.js installed, install the package as follows:

[sudo] npm install grp-cli -g

Note:

  • Whether you need sudo depends on how you installed Node.js / io.js and whether you've changed permissions later; if you get an EACCES error, try again with sudo.
  • The -g ensures global installation and is needed to put grp in your system's $PATH.

Manual installation

  • Download the CLI as grp.
  • Make it executable with chmod +x grp.
  • Move it or symlink it to a folder in your $PATH, such as /usr/local/bin (OSX) or /usr/bin (Linux).

Usage

Find concise usage information below; for complete documentation, read the manual online or, once installed, run man grp (grp --man if installed manually).

$ grp --help


Format numbers with digit grouping:

    grp -n [-t <term>] [<num>...]

Break text into groups of characters:

    grp [-l | -r] [-c <count>] [-s <sep> | -f <fmt>] [-t <term>] [<txt>...]

Options:

    -n          apply locale-aware digit grouping to input numbers
    -t <term>   terminator to append to each argument's result; default: \n
    -l, -r      start grouping from left / right (default)
    -c <count>  count of chars. per group - may be comma-separated list
    -s <sep>    either: separator to place between groups; default: a space
    -f <fmt>    or: printf-style format string to apply to groups

License

Copyright (c) 2015-2016 Michael Klement [email protected] (http://same2u.net), released under the MIT license.

Acknowledgements

This project gratefully depends on the following open-source components, according to the terms of their respective licenses.

npm dependencies below have optional suffixes denoting the type of dependency; the absence of a suffix denotes a required run-time dependency: (D) denotes a development-time-only dependency, (O) an optional dependency, and (P) a peer dependency.

npm dependencies

Changelog

Versioning complies with semantic versioning (semver).

  • v0.1.4 (2016-06-05):

    • [fix] When using -n to group numbers, the -t option is now respected.
    • [enhancement] Improved detection of invalid numbers when using -n.
  • v0.1.3 (2015-09-17):

    • [doc] grp now comes with a man page (invoke with grp --man in case of manual installation); grp -h now just prints concise usage info.
  • v0.1.2 (2015-09-15):

    • [dev] Makefile improvements; various other behind-the-scenes tweaks.
  • v0.1.1 (2015-06-13):

    • [doc] Read-me fixed and amended.
  • v0.1.0 (2015-06-13):

    • Initial release.