#!/bin/bash for X in `cat who.fake | awk -F' ' '{print $1}' | sort | uniq` ;do C=`cat ps.fake | grep -E "^$X" | wc -l` echo $X $C done