Hi group,
I just installed Debian and ran into this problem.
When I run this bash script that calls awk, all the output is on a single line.
Code:
#!/bin/bash
IP_Text=`/sbin/ifconfig | \
awk '{ ORS = "\n\n" }{ \
if($0 ~ /Ethernet/ || \
$0 ~ /Point-to-Point/ ) { \
printf("%s:", $1); \
Line=getline; \
Line=$2; \
if(Line ~ /addr/ ) { \
n=split(Line,Array,":"); \
printf("%s\n\n",Array[2]); } \
else { \
printf("None\n\n"); } \
print "Done\n"; } }'`
echo ${IP_Text}
The output looks like this:
Code:
$ IP_Addr
eth0:None Done ppp0:66.81.51.154 Done
I'm running mawk 1.3.3 Nov 1996, Copyright (C) Michael D. Brennan
Any ideas??