Sha256: 515ed3ac1be7094ea9cb3f2ae08237d1e7ebcda75351f2547ed34cd9d24c3354

Contents?: true

Size: 495 Bytes

Versions: 92

Compression:

Stored size: 495 Bytes

Contents

#!/usr/bin/env bash

input="$1"

if [[ ! -n "${input}" ]]
then
	echo "Usage: $0 <input>"
	exit
fi

echo "$input" \
  | tr '[:upper:]' '[:lower:]' \
  | tr '.,:&@$%^!' ' ' \
  | awk -f <(cat - <<-'HEREDOC'
      {
        for (field_index = 1; field_index <= NF; field_index++)
        {
          result[$field_index]++
        }
      }
      END {
        for (field_index in result)
        {
          printf "%s: %d\n", field_index, result[field_index]
        }
      }
HEREDOC
)

exit $?

Version data entries

92 entries across 92 versions & 1 rubygems

Version Path
trackler-2.2.1.98 tracks/bash/exercises/word-count/example.sh
trackler-2.2.1.97 tracks/bash/exercises/word-count/example.sh
trackler-2.2.1.96 tracks/bash/exercises/word-count/example.sh
trackler-2.2.1.95 tracks/bash/exercises/word-count/example.sh
trackler-2.2.1.94 tracks/bash/exercises/word-count/example.sh
trackler-2.2.1.93 tracks/bash/exercises/word-count/example.sh
trackler-2.2.1.92 tracks/bash/exercises/word-count/example.sh
trackler-2.2.1.91 tracks/bash/exercises/word-count/example.sh
trackler-2.2.1.90 tracks/bash/exercises/word-count/example.sh
trackler-2.2.1.89 tracks/bash/exercises/word-count/example.sh
trackler-2.2.1.88 tracks/bash/exercises/word-count/example.sh
trackler-2.2.1.87 tracks/bash/exercises/word-count/example.sh