Re: Define an alias with an embeded awk command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



m.roth@xxxxxxxxx wrote:
>> m.roth@xxxxxxxxx wrote:
>>> Simpler, and more obvious to read:
>>>
>>> /sbin/ifconfig eth0 | awk '{if ( $0 ~ /inet addr:/ ) {print
>>> substr($2,6)}}'
>> That's only obvious to the couple of people who speak awk...  (Probably
>> about the same number that use the C shell that started this problem).
>>
>> With more generic regexps it would be:
>>
>> ifconfig eth0 |sed  -n -e 's/\(.*inet addr:\)\([0-9.]*\)\(.*\)/\2/p'
> 
> Right, and that's obvious to the meanest intelligence, while "if what I
> read in has this, then print this part of that field" is sooo complicated.
> 
> Are you willing to agree to differ, and stop attacking me, when I give one
> awk script to replace 3-4 commands?
> 

It wasn't an attack - and the one sed command does the same thing with 
an even more lightweight program.  And perl could do it without running 
ifconfig.

-- 
   Les Mikesell
    lesmikesell@xxxxxxxxx
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux