Skip to content

Instantly share code, notes, and snippets.

@BH1SCW
Created April 15, 2010 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BH1SCW/366804 to your computer and use it in GitHub Desktop.
Save BH1SCW/366804 to your computer and use it in GitHub Desktop.
#!/bin/bash -u
thisCount=0
names=()
if [ $# -eq 1 ] ; then
data=`cut --delimiter=: --fields=5 ${1}`
all=`echo ${data} | cut --delimiter=' ' --fields=1`
for X in ${all} ; do
skip=0
for checked in ${names} ; do
if [ ${checked} == ${X} ]; then
skip=1
break
fi
done
if [ ${skip} == 1 ]; then
continue
else
thisCount=0
names[$[${#names[@]}+1]]=${X}
for Y in ${all} ; do
if [ ${Y} == ${X} ]; then
((thisCount++))
fi
done
echo "${X} ${thisCount}"
fi
done
else
echo "Invalid argument count."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment