ProductPromotion
Logo

Go.Lang

made by https://0x3d.site

GitHub - timdp/lwc: A live-updating version of the UNIX wc command.
A live-updating version of the UNIX wc command. Contribute to timdp/lwc development by creating an account on GitHub.
Visit Site

GitHub - timdp/lwc: A live-updating version of the UNIX wc command.

GitHub - timdp/lwc: 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

Articles
to learn more about the golang concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

Queries
or most google FAQ's about GoLang.

mail [email protected] to add more queries here ๐Ÿ”.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory