Hey all,
I have a list of files containing the results of an ifconfig command on a bunch of linux servers:
example:
server1_ifconfig1, server2_ifconfig.txt , server3_ifconfig.txt
I want to generate report using awk to print out the file name and the port name along with the IP address:
example:
server1_ifconfig eth0 addr:10.136.126.124 Bcast:10.136.127.255 Mask:255.255.254.0
server1_ifconfig eth1 addr:10.152.154.134 Bcast:10.152.155.255 Mask:255.255.254.0
server2_ifconfig eth0 addr:10.136.126.125 Bcast:10.136.127.255 Mask:255.255.254.0
server2_ifconfig eth1 addr: 10.152.154.135 Bcast:10.152.155.255 Mask:255.255.254.0
server3_ifconfig eth0 addr:10.136.126.126 Bcast:10.136.127.255 Mask:255.255.254.0
server3_ifconfig eth1 addr:10.152.154.136 Bcast:10.152.155.255 Mask:255.255.254.0
The port info I can do but I can't seem to be able to grab the file name and use it in the output. I'm using awk in a bash do look to read the files:
example:
for i in `ls | grep -e "Link encap" -e "Mask" `
do
awk statement
done
the value "i" disappears in this example. How do I retain the file name "
Thanks
