A live-updating version of the UNIX wc command.

Related tags

DevOps Tools lwc
Overview

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

You might also like...
A tool to restart a Docker container with a newer version of the image

repull A tool to restart a Docker container with a newer version of an image used by the container Often you may need to pull a newer version of an im

Semantic version generator using git commit keywords and overrides

Semantic version generator Project created overnight, to prove that management of semantic versioning is NOT painful and do not require arguments and

Mutagen Compose is a modified version of Docker Compose that offers automated integration with Mutagen.

Mutagen Compose Mutagen Compose is a (minimally) modified version of Docker Compose that offers automated integration with Mutagen. This allows you to

Transform latin letters to runes & vice versa. Go version.

Riimut Transform latin letters to runes & vice versa. Go version. Includes transformers for four main runic alphabets: Elder Futhark Younger Futhark M

Minified version of Project Sherlock written in GO

Minified version of Project Sherlock written in GO

UpdatedFlowtbag - An updated version of Flowtbag

License Copyright 2011 Daniel Arndt Licensed under the Apache License, Version 2

Valse is an kubernetes exporter application that discovers resources such as version
Valse is an kubernetes exporter application that discovers resources such as version

What is the Valse? Valse is an kubernetes exporter application that discovers resources such as version, namespaces, node, pod, deployment, daemonset,

Golangver - Go's distributives version manager

golangver Go's distributive version manager (knitted myself with love :) Require

A golang package for comparing and working with k0s version numbers

version A go-language package for managing k0s version numbers. It is based on hashicorp/go-version but adds sorting and comparison capabilities for t

Releases(v0.4.5)
Owner
Tim De Pauw
Node Enthusiast. Web Enthusiast. Procrastination Enthusiast.
Tim De Pauw
Automatic-Update-Launcher - A general purpose updater for updating program binaries when update folder exists

Automatic Update Launcher A general purpose updater for updating (web) applicati

Toby Chui 4 Jun 27, 2022
A file find utility modeled after the unix find written in Go

gofind A file find utility modeled after the unix find written in Go. Why This p

Jack D 0 Dec 17, 2021
This project will help you to create Live img.shields.io Badges which will Count YouTube Stats (Subscriber, Views, Videos) without YouTube API

Free YouTube Stats Badge This project will help you to create Live img.shields.io Badges which will Count YouTube Stats (Subscriber, Views, Videos) wi

Pushpender Singh 1 Dec 17, 2021
🔎 gowatch Live reload for go apps.

Watch ?? gowatch Live reload for go apps Motivation I had no app to live reload my Go programs. Usage Install go install github.com/gelfand/gowatch ◆

Eugene 0 Dec 29, 2021
Litestream-read-replica-demo - A demo application for running live read replication on fly.io with Litestream

Litestream Read Replica Demo A demo application for running live read replicatio

Ben Johnson 67 Aug 6, 2022
An example of using Litestream's live read replication feature.

Litestream Read Replica Example This repository is an example of how to setup and deploy a multi-node SQLite database using Litestream's live read rep

Ben Johnson 42 Sep 3, 2022
"go build" wrapper to add version info to Golang applications

govvv The simple Go binary versioning tool that wraps the go build command. Stop worrying about -ldflags and go get github.com/ahmetb/govvv now. Build

Ahmet Alp Balkan 528 Sep 2, 2022
Go Version Manager

gvm By Josh Bussdieker (jbuss, jaja, jbussdieker) while working at Moovweb Currently lovingly maintained by Benjamin Knigge Pull requests and other an

Moovweb 7.8k Sep 27, 2022
Go version manager. Super simple tool to install and manage Go versions. Install go without root. Gobrew doesn't require shell rehash.

gobrew Go version manager Install or update With curl $ curl -sLk https://git.io/gobrew | sh - or with go $ go get -u github.com/kevincobain2000/gobre

Pulkit Kathuria 133 Sep 17, 2022
"go build" wrapper to add version info to Golang applications

govvv The simple Go binary versioning tool that wraps the go build command. Stop worrying about -ldflags and go get github.com/ahmetb/govvv now. Build

Ahmet Alp Balkan 529 Sep 24, 2022