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


Thank you | 20 comments | Create New Account
Click here to return to the 'Thank you' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Thank you
Authored by: Whosawhatsis on Oct 19, '05 12:33:05PM

Thank you. I get so sick of people using grep for things that awk should be doing.

Learn to use awk correctly: http://www.vectorsite.net/tsawk.html

---
I was offered a penny for my thoughts, so I gave my two cents... I got ripped off.



[ Reply to This | # ]
Thank you
Authored by: kps on Oct 19, '05 05:47:42PM
I get so sick of people using awk for things that sed should be doing :-)
ifconfig | sed -n -e '/127.0.0.1/d' -e 's/.*inet \(.*\) netmask.*/\1/p'
(I also get sick of macosxhints eating backslashes.)

[ Reply to This | # ]
Thank you
Authored by: Whosawhatsis on Oct 20, '05 05:06:03PM
To get the same output using awk:
ifconfig | awk '$1 ~ /^inet$/ && $2 !~ /^127.0.0.1$/ {print $2}'
Shorter, and no backslashes to be stripped out :P

---
I was offered a penny for my thoughts, so I gave my two cents... I got ripped off.

[ Reply to This | # ]