If you're hoping to do a pure ruby implementation of this, heed the others.

If you just need the values, here's the awk:

awk 'BEGIN { ORS="" } /up.*down.*aenet/ { print $6 }' file...

or,

awk -v ORS='' '/up.*down.*aenet/ { print $6 }' file...

(you don't need the cat or either grep)


On Tue, Nov 6, 2012 at 4:21 PM, Ferdous ara <lists / ruby-forum.com> wrote:
> Hi,
> Dont know how to explain this.
>
> example , i am doing this
>
> output=`cat #{file} | grep  "up    down" | grep "aenet" | awk '{print
> $6}'`
> puts output
>
>
> So i get this
> ae40.0
> ae30.0
>
> But i want to output like ae40.0 ae30.0
>
> how can i achieve this ??
>
> Thanks for your help.
>
> --
> Posted via http://www.ruby-forum.com/.
>