Else statement in looking for a character

I have list of hostnames with

# cat list
servdc01
servdc02
compdc01
compdc02
servit01
servit02
prindc01
datacenter01
dcenit01
dcendc01
[root]


If the hostname has dc in 5,6. Copy a file dedicated for them,
if the hostname has IT in 5,6. Copy a file dedicated for them.

dc=`cat list|grep dc`  # I cant do this because it will get this data dcendc01
it= `cat list|grep it`
if [ $dc -ne 0 ]
then
cp /files/intended_for_dc_hosts $dc
fi


if [ $it -ne 0 ]
then
cp /files/intended_for_it_hosts $it
fi
. . .

if you insist on using grep....

grep -E '^....dc' myFile
grep -E '^....it' myfile