Or even simpler ( I should really stop typing before I think... ):
Code:
awk '{print $2 ", " $1}' FileA >> FileB
If there are lines in there that you don't want, there are some fun things that you can do with grep and regular expressions too. Here's my DNS zone > /etc/hosts script. I'm only looking for a particular subnet, so it's pretty simple. I use SSH keys, so the ssh part is non-interactive:
Code:
#!/bin/sh
ssh root@192.168.1.40 "cat /var/named/techsupport.local.zone|grep '192.168.1'" > /tmp/zone.local
echo "# Do not remove the following line, or various programs" > /etc/hosts
echo "# that require network functionality will fail." >> /etc/hosts
echo "127.0.0.1 localhost.localdomain localhost" >> /etc/hosts
awk '{print $3 " " $1}' /tmp/zone.local >> /etc/hosts
exit
Hope it helps!
-Jeo