On Tue, 21 Jul 2009 12:24:09 +0100, chris scott <kra...@googlemail.com> wrote: > > a=`echo $ifconfig_bge0 | /usr/bin/awk '{ for ( i=1 ; i <= NF; i++) { if ( $i > ~ /[iI][nN][eE][tT]/ ) { sub(/\/.*/,"", $(i+1)); print $(i+1) } } }'` > rsyncd_flags="--config=/etc/rsyncd.conf --address=$a"
This is far too complex for my taste. If you are certain that you will have all the tools around (/usr /usr/local and so on), then it may be simpler to use something like: addr=$( ifconfig lagg0 | perl -ne 'print "$1\n" if (m/^.*inet\s+(\S+)\s.*$/);' ) This seems to work without all the looping/sub in awk: $ ifconfig lagg0 | perl -ne 'print "$1\n" if (m/^.*inet\s+(\S+)\s.*$/);' 192.168.1.3 _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"