print word after pattern match in two instances

i have a file like below. how can i printout the digits followed by the pattern -bwout and -bwin. say i run the script by entering line number 145 (the fourth line), then the o/p should be like
5000000 1024000

8 test1 -ipprot erp -ppsout 500 -ppsin 500 -bwout 300000 -bwin 300000 -statsdevice test1 -stats 
30 test2 -addr a.b.c.249 -wdwthresh 3 -bwout 512000 -bwin 512000 -statsdevice test2 -stats 
125 test3 -addr a.b.c.0 -addrmsk 255.255.255.0 -bwlink total1 -statsdevice testing3 -stats -global 
145 test4 -group -bwout 1024000 -bwin 5000000 -statsdevice group4 -stats 
1451 test5 -addr a.b.c.251 -bwout 256000 -bwin 512000 -bwlink test4 -statsdevice test5 -stats 
14539 test6 -addr a.b.c.34 -bwboth 128000 -bwlink xyz128 -statsdevice abc123 -stats

did i make myself clear?

tia

Could this help you ?

awk -v v1=145 '$1 == v1{for(i=1;i<=NF;i++){if(j==1){printf $(i)FS ;j=0};if($i =="-bwout" || $i == "-bwin"){j=1} }printf "\n"}' inputfile
sed '/^145 /!d;s/^.*-bwout \([^ ]*\).*-bwin \([^ ]*\).*$/\1 \2/' infile

or (to ensure that lines without bwout or bwin are not displayed) :

sed '/-bwout/!d;/-bwin/!d;/^145 /!d;s/^.*-bwout \([^ ]*\).*-bwin \([^ ]*\).*$/\1 \2/' infile
sed -n '/^145 / {s/.*-bwout \([0-9]*\).*-bwin \([0-9]*\).*/\2 \1/;p}' infile

Thank you all

What will happen if the line is like below? How to get the same info for number 2255?

/usr/bwmgr/utils/bwmgr em1 -x 2255 -name radius1 -addr a.b.c.0 -addrmsk 255.255.255.224 -bwout 1024000 -bwin 2048000 -statsdevice radius1 -stats

tia

echo '/usr/bwmgr/utils/bwmgr em1 -x 2255 -name radius1 -addr a.b.c.0 -addrmsk 255.255.255.224 -bwout 1024000 -bwin 2048000 -statsdevice radius1 -stats'|
sed 's/.*-x \([^ ]*\) .*/\1/'
sed '/-bwout/!d;/-bwin/!d;/ -x 2255 /!d;s/^.*-bwout \([^ ]*\).*-bwin \([^ ]*\).*$/\1 \2/' infile

thank you all