ifconfig
has two output modes -- the default one in which it gives a LOT more output, and the short -s
one in which it gives less (or, rather, picks different bits of info from what you'd like). So what about taking ifconfig in the default mode and cherry-picking the specific info you want in a script (python, perl, ruby, awk, bash+sed+..., whatever floats your boat;-). E.g., w/Python:
import re
import subprocess
ifc = subprocess.Popen('ifconfig', stdout=subprocess.PIPE)
res = []
for x in ifc.stdout:
if not x.strip():
print ' '.join(res)
del res[:]
elif not res:
res.append(re.match(r'\w+', x).group())
else:
mo = re.match(r'\s+inet addr:(\S+).*Mask:(\S+)', x)
if mo:
res.extend(mo.groups())
elif re.match(r'\sUP\s', x):
res.append('up')
elif re.match(r'\sDOWN\s', x):
res.append('down')
if res: print ' '.join(res)
and the output should be as you desire it (easy to translate in any of the other languages I mentioned, I hope).