
Frequency Hash in Multiple Languages
Summary of Articles on Using Frequency Hash
I wrote a few articles on using a frequency hash in various languages to show some features of the languages that are useful in operations scripting and automation chores. These articles may be useful as a way to compare and contrast the languages and approaches.
Python
The Problem
The Solution with Iteration
Demonstrates procedural way with for…in open()
loop construct.
The Solution in Serial Functional Way
Demonstrates how to build a dictionary with filter()
and map()
methods and introduces regex.
Ruby
The Problem
The Solution with Iteration
This demonstrates using procedural methods with File.open {}
construct.
The Solution in Serial Functional Way
This shows how to use select {}
and map {}
methods to build the hash and introduces regex.
Perl
This article has both the problem and solutions using procedural while loop and more serial approach with functional programming style using grep {}
and map {}
.
Shell (BASH)
The Problem
The Solution in a Procedural Way
This shows how to use either while read
or for
to process files and ways to split text with Bash.
Ops Scripting w. Bash: Frequency 2
Tracking Frequency in BASH (Bourne Again Shell): Part II
medium.com
The Solution in Pipeline with Subshell
This article shows how to use either internal split mechanism or external tools like cut
, sed
, awk
, grep
, and perl
to split and filter text.