• Stars
    star
    32
  • Rank 774,341 (Top 16 %)
  • Language
    Go
  • License
    MIT License
  • Created about 6 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A live-updating version of the UNIX wc command.

lwc

Go Report Card Build Status Coverage Status Release

A live-updating version of the UNIX wc command.

Installation

You can get a prebuilt binary for every major platform from the Releases page. Just extract it somewhere under your PATH and you're good to go.

Alternatively, use go get to build from source:

go get -u github.com/timdp/lwc/cmd/lwc

On Debian-compatible Linux distributions such as Ubuntu, you can also use the experimental APT repository:

echo 'deb [allow-insecure=yes] https://tmdpw.eu/lwc-releases/debian/ any main' |
  sudo tee /etc/apt/sources.list.d/lwc.list
sudo apt update
sudo apt install lwc

Usage

lwc [OPTION]... [FILE]...
lwc [OPTION]... --files0-from=F

Without any options, lwc will count the number of lines, words, and bytes in standard input, and write them to standard output. Contrary to wc, it will also update standard output while it is still counting.

All the standard wc options are supported:

  • --lines or -l
  • --words or -w
  • --chars or -m
  • --bytes or -c
  • --max-line-length or -L
  • --files0-from=F
  • --help
  • --version

In addition, the output update interval can be configured by passing either --interval=TIME or -i TIME, where TIME is a duration in milliseconds. The default update interval is 100 ms.

Examples

Count the number of lines in a big file:

lwc --lines big-file

Run a slow command and count the number of lines and words logged:

slow-command | lwc --lines --words

Benchmark lwc's throughput by counting random bytes (press Ctrl+C to exit):

lwc --bytes < /dev/urandom

Caveats

You can mostly use lwc as a drop-in replacement for wc. However, you should be aware of the following:

  • The behavior of the --words and --chars options is slightly different from wc's implementation. You might get different values with certain binary data.

  • While lwc is pretty fast, you won't get the same raw throughput as with wc. The reason for that is (probably) twofold: the code isn't optimized for performance, and a Go implementation is no match for a C one.

JavaScript Version

This utility briefly existed as a Node.js package. I'm keeping the code around for educational purposes, but I will no longer be maintaining it.

Author

Tim De Pauw

License

MIT

More Repositories

1

es6-promise-pool

Runs Promises in a pool that limits their concurrency.
JavaScript
373
star
2

swirly

A marble diagram generator.
TypeScript
105
star
3

winston-aws-cloudwatch

A Winston transport for Amazon CloudWatch.
JavaScript
46
star
4

metalsmith-discover-partials

Discovers your template partials and registers them with Handlebars.
JavaScript
12
star
5

kodi-missing-episodes

Checks your Kodi TV library for missing episodes using Trakt.
TypeScript
9
star
6

metalsmith-discover-helpers

Discovers your template helpers and registers them with Handlebars.
JavaScript
9
star
7

rollup-timer

Times Rollup plugins by monkey-patching plugin API functions.
JavaScript
7
star
8

plugin.video.deredactie

Kodi plugin to watch videos from deredactie.be.
Python
7
star
9

jflow

Cover Flow for Java Swing.
Java
7
star
10

esbuild-plugin-import-pattern

esbuild plugin that imports modules based on wildcard patterns.
JavaScript
5
star
11

samovar

A pure-JSON template language and renderer. Also supports YAML.
JavaScript
5
star
12

rollup-load-plugins

Loads Rollup plugins listed in package.json.
JavaScript
4
star
13

http-aws4

Performs AWS Signature Version 4-signed HTTP requests from the command line.
JavaScript
4
star
14

asdf-bump

Interactive upgrades for asdf.
JavaScript
4
star
15

chicago-capitalize

Capitalizes a title according to the Chicago Manual of Style.
JavaScript
4
star
16

rollup-plugin-mustache

Precompiles Mustache templates using Hogan.js.
JavaScript
3
star
17

minivault

A pretty rudimentary vault (Web front end).
JavaScript
3
star
18

fancy-rollup

Multi-process Rollup wrapper.
JavaScript
3
star
19

atom-npm-helper

Search the npm registry and install packages from Atom.
JavaScript
3
star
20

aws-lambda-node-wrapper

Runs recent versions of Node.js on AWS Lambda.
JavaScript
3
star
21

hampster

Installs and links interdependent npm packages.
JavaScript
3
star
22

minivault-rest

A pretty rudimentary vault (RESTful API).
JavaScript
2
star
23

event-registry

Keeps track of EventEmitter listeners and automatically removes them upon selected events.
JavaScript
2
star
24

rollup-plugin-resolve-aliases

Resolves aliases.
JavaScript
2
star
25

picard

GitHub-style punchcards meet pie charts.
JavaScript
2
star
26

babel-preset-es2015-generators-async

babel-preset-es2015 minus regenerator plus async-to-module-method.
JavaScript
2
star
27

minivault-core

A pretty rudimentary vault (core API).
JavaScript
2
star
28

dune-movie-prettifier

Creates nice movie listings for Dune HD media players.
Perl
2
star
29

regexfu

A simple Java Swing GUI to try out regular expressions.
Java
1
star
30

jquery-selecttext

jQuery plugin to select all text in an element
JavaScript
1
star
31

dune-tv-prettifier

Creates nice TV series listings for Dune HD media players.
Perl
1
star
32

rollup-plugin-strip-logger

Strips out references to a logger package.
JavaScript
1
star
33

bucketeer

Bulk-processes objects inside an Amazon S3 bucket.
JavaScript
1
star
34

rollup-plugin-assert-es

Verifies that bundled code is ES5.
JavaScript
1
star
35

rollup-plugin-transform-code

Performs simple code transformations.
JavaScript
1
star
36

burrata

Robust, developer-friendly postMessage.
JavaScript
1
star
37

rollup-plugin-cssnext

Easy integration between Rollup and cssnext.
JavaScript
1
star
38

depviz

Visualizes intra-monorepo dependencies.
JavaScript
1
star
39

diagnosis

Runs a series of client-side health checks.
JavaScript
1
star
40

stream-capacitor

Throttles streams based on customizable throughput.
JavaScript
1
star
41

lwc-nodejs

A live-updating version of the UNIX wc command.
JavaScript
1
star
42

karma-mocha-iframes

Runs every Mocha-based Karma test in its own iframe.
JavaScript
1
star
43

mitmproxy-scripts

Scripts that I use with mitmproxy.
Python
1
star