[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Counting words, fast!
From: |
Jesse Hathaway |
Subject: |
Re: Counting words, fast! |
Date: |
Wed, 17 Mar 2021 10:37:08 -0500 |
On Wed, Mar 17, 2021 at 7:07 AM Greg Wooledge <greg@wooledge.org> wrote:
> One might argue that when writing a shell script, the POSIX utilities
> are the "standard library". They are *meant* to be used. The shell's
> built-in feature set is severely limited *because* it's designed to
> use these tools to do the heavy lifting.
For sure there is an argument to be made, but a shell example was already
provided[1]:
tr 'A-Z' 'a-z' | tr -s ' ' '\n' | LC_ALL=C sort -S 2G | uniq -c | sort -nr
So I thought it would be fun to try a version just using Bash with no external
programs.
[1]: https://github.com/benhoyt/countwords/blob/master/optimized.sh
- Counting words, fast!, Jesse Hathaway, 2021/03/16
- Re: Counting words, fast!, Leonid Isaev (ifax), 2021/03/16
- Re: Counting words, fast!, Greg Wooledge, 2021/03/16
- Re: Counting words, fast!, Jesse Hathaway, 2021/03/16
- Re: Counting words, fast!, Dennis Williamson, 2021/03/16
- Re: Counting words, fast!, Jesse Hathaway, 2021/03/17
- Re: Counting words, fast!, Dennis Williamson, 2021/03/17
- Re: Counting words, fast!, Jesse Hathaway, 2021/03/17
- Re: Counting words, fast!, Greg Wooledge, 2021/03/17
- Re: Counting words, fast!,
Jesse Hathaway <=
- Re: Counting words, fast!, Koichi Murase, 2021/03/19
- Re: Counting words, fast!, Dennis Williamson, 2021/03/19
- Re: Counting words, fast!, Jesse Hathaway, 2021/03/19
- Re: Counting words, fast!, Koichi Murase, 2021/03/19
- Re: Counting words, fast!, Koichi Murase, 2021/03/19
- Re: Counting words, fast!, Lawrence Velázquez, 2021/03/20
- Re: Counting words, fast!, Jesse Hathaway, 2021/03/22