SUMMARY: Adding entries to /etc/hosts on different servers



Hello Managers
Thanks for all the help. By playing with the following terrific clues, I managed my problem.

Denes, Daniel
cat /etc/hosts | nawk '{for (i = 2; i<= NF; i++) print $i;}' | grep
'ss[0-9]*$'

Hutin Bertrand
bash-2.05# awk '/ts/{print $2}' /etc/hosts |uniq
bash-2.05# awk '/ss/{print $2}'/etc/hosts |uniq

Matthew Stier
awk '$0 !~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/ { next; } $2 ~
/[ts]s[0-9]+$/ { print $2 }' /etc/hosts | uniq

Sandwich Maker
#!/usr/bin/ksh -p
# quick kornshell hack to extract hostnames ending in ts or ss
# optionally followed by digits

while read IP HOST JUNK
do
case $HOST in
*[ts]s*([0-9])) print $HOST;;
esac
done < /etc/hosts | sort -u

Crist Clark
$ awk '$2 ~ /[st]s/ {printf "%s\t%s\n" $1 $2}' /etc/hosts | uniq

Brad_Morrison
nawk '/[st]s[0-9]/ {for (i=2; i<=NF; i++) if ($i ~ /[st]s[0-9]$/) printf("%s\t%s\n",$1,$i)}' > somefile

Regards

Rob







---------------------------------
Make free worldwide PC-to-PC calls. Try the new Yahoo! Canada Messenger with Voice
_______________________________________________
sunmanagers mailing list
sunmanagers@xxxxxxxxxxxxxxx
http://www.sunmanagers.org/mailman/listinfo/sunmanagers