-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Landy Roman wrote:
looking thru the archieves i saw your tip on getting ip, i tried it but it seems the last portion of awk FS end does not work for me.... any ideas?
Ok, I got an answer from Darrel Hankerson, one of the awk authors, pointing me to the documentation :-) And he says: # According to the POSIX standard, `awk' is supposed to behave as if # each record is split into fields at the time that it is read. In # particular, this means that you can change the value of `FS' after a # record is read, and the value of the fields (i.e. how they were split) # should reflect the old value of `FS', not the new one. # However, many implementations of `awk' do not work this way. # Instead, they defer splitting the fields until a field is actually # referenced. The fields will be split using the *current* value of # `FS'! (d.c.) This would then be the suggested format, I guess: /sbin/ifconfig eth0 | grep inet | awk '{print $2}' | awk -F ":" '{print $2}' Or... if you have ipv6 loaded as well ( default on SuSE 7.x ) /sbin/ifconfig eth0 | grep "inet addr" | awk '{print $2}' | awk -F ":" '{print $2}' Hope this helps. - -tosi This also goes to suse-linux-e@suse.com. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.4 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE62xrb6mRH+PEpr2YRAimXAJwPWf6GAWOvJm9NG6e+UCKX8DoE3QCeJLd2 REdaXycOnmn5uKNQSiyeiYc= =mOKv -----END PGP SIGNATURE-----