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 |
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. |
Or
Code:
vxprint -l | awk 'BEGIN{IGNORECASE=1} /subdisk/{_ ? _=_ " " $2 : _=$2}END{print _}' Code:
echo $(vxprint -l | grep -i subdisk | awk '{print $2}') |
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. |