Author: David Wolfskill
Date: 11-10-01 17:58
Happened across the example for extracting the IP address,
which involves a pipeline similar to the following (translated
to use the NIC I happen to have on the machine I'm using at the
moment):
ifconfig an0 | grep "inet " | awk '{print $2}'
Comment is that it's fairly rare to actually need the "grep"
invocation if you're invoking "awk" anyhow; try:
ifconfig an0 | awk '/inet / {print $2}'
(Hmmm... looking at this, I note that it you have multiple IP
addresses assigned to the NIC in question -- of course, for this
application, no one would do that, I suppose.... Anyhow, things
could get Fairly Weird for someone who might try such a thing.)
|
|