1#!/usr/bin/awk -f
2
3# Print only active ifaces from ifconfig
4#    from http://unix.stackexchange.com/questions/103241/how-to-use-ifconfig-to-show-active-interface-only
5#    (using a version without pcregrep because that may not be available)
6#
7# We need the ip of an active network interface in order to properly launch the
8# dockerized Kafka cluster.
9
10BEGIN            { print_it = 0  }
11/status: active/ { print_it = 1  }
12/^($|[^\t])/     { if(print_it) print buffer; buffer = $0; print_it = 0  }
13/^\t/            { buffer = buffer "\n" $0  }
14END              { if(print_it) print buffer  }
15