0

I want to print out the bit rate and signal level of iwconfig in one row and separate with space. So far I use different command to print the bit rate and signal strength separately like this :

iwconfig wlan0 | awk -F'[ =]+' '/Bit Rate/ {print $4}'

iwconfig wlan0 | awk -F'[ =]+' '/Signal level/ {print $7}'

and the result will be

54

-43

Is it possible to make them like this :

54 -43

What should I do? Thank you

Community
  • 1
  • 1
bnbfreak
  • 353
  • 3
  • 14

1 Answers1

0
One simple way is to assign the output of your commands
to variables.  That way, you can print them out however you want.
I just tested this on Ubuntu 12.4.  Note the back quotes around
the commands.

v1=`iwconfig wlan0 | awk -F'[ =]+' '/Bit Rate/ {print $4}'`

v2=`iwconfig wlan0 | awk -F'[ =]+' '/Signal level/ {print $7}'`

echo $v1 $v2
rmcghee
  • 419
  • 4
  • 6