Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Change location automatically based on network' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Change location automatically based on network
Authored by: BobHarris on Aug 16, '05 10:53:09PM
nit picking just a little

arp `netstat -r | grep ^default | awk '{print $2}'` | \
perl -pe 's/^.* at //g' | perl -pe 's/ on .*$//g'

can be simplified slightly by combining the grep into the awk


arp `netstat -r | awk '/^default/ {print $2}'` | \
perl -pe 's/^.* at //g' | perl -pe 's/ on .*$//g'


[ Reply to This | # ]
Change location automatically based on network
Authored by: cp on Aug 16, '05 11:12:24PM
Crikey, you call that simplified? You perl people make me laugh.
 arp `netstat -r | awk '/^default/ {print $2}'` | cut -f4 -d" "    
does exactly the same thing without fscking perl!!

cmlp

[ Reply to This | # ]