LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   help tweaking data output in Linux (https://www.linuxquestions.org/questions/linux-newbie-8/help-tweaking-data-output-in-linux-4175445928/)

Big_D 01-16-2013 04:19 PM

help tweaking data output in Linux
 
Hi, I'm new to this forum and am hoping that the command I'm looking for exists! I use the following command to grab data off of servers but I would like have the data displayed differently. Here is the command and the output, I should note that this is a veritas command:

vxprint -l | grep -i subdisk | awk '{print $2}'

appldg01-01
appldg01-02
appldg01-03
appldg01-04
appldg01-05
appldg01-06
appldg01-07
appldg01-08
appldg01-09
appldg01-10


Now I would like the data to be displayed like this instead:
appldg01-01 appldg01-02 appldg01-03 appldg01-04 appldg01-05 appldg01-06 etc...

If this is possible and you know the answer I will be eternally grateful!

Thanks,
Darin

jpollard 01-17-2013 04:23 AM

The simplest change is to replace "print $2" with printf "%s",$2.

Now there will be no end of line indicator so you might want to add 'END {print}' after the closing brace.

colucix 01-17-2013 04:35 AM

Or
Code:

vxprint -l | awk 'BEGIN{IGNORECASE=1} /subdisk/{_ ? _=_ " " $2 : _=$2}END{print _}'
Another option is by means of echo:
Code:

echo $(vxprint -l | grep -i subdisk | awk '{print $2}')

Big_D 01-17-2013 09:02 AM

Awesome, thank you so much!! This will save me tons of time going forward.


All times are GMT -5. The time now is 11:48 PM.