You are on page 1of 1

#!

/bin/bash

if [[ $# -ne 1 ]]; then


echo "Usage: $0 <input_file>"
exit 1
fi
input_file="$probes.txt"
mapfile -t lines_array < "$input_file"
declare -A occurrence_map
for line in "${lines_array[@]}"; do
last_part=$(echo "$line" | awk '{print $NF}')
((occurrence_map["$last_part"]++))
done
for key in "${!occurrence_map[@]}"; do
echo "$key: ${occurrence_map[$key]}"
done

You might also like