You're replying to a comment by simpleton.

simpleton Permalink
September 30, 2008, 19:10

Yep, you are right, mine won't work because of IP address length problems.

A corrected version using grep and cut is ~45 characters.

ifconfig|grep t\ a|cut -d" " -f12|cut -d: -f2

I still think you aren't counting right though. Please count the characters in:

ifconfig|perl -nE'/dr:(\S+)/&&say$1'

by hand, and you will get 36.


[x@x ~]# ifconfig|perl -nE'/dr:(\S+)/&&say$1'
[x@x ~]# 123456789012345678901234567890123456


[x@x ~]$ echo -n "ifconfig|perl -nE'/dr:(\S+)/&&say$1'" | wc -c
[x@x ~]$ echo -n "ifconfig|perl -nE'/dr:(\S+)/&&say'" | wc -c

"$1" is getting expanded to nothing, and you lose those characters in the count.

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "network_90": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.