LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-16-2013, 05:19 PM   #1
Big_D
LQ Newbie
 
Registered: Jan 2013
Posts: 2

Rep: Reputation: Disabled
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
 
Old 01-17-2013, 05:23 AM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,604

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
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.
 
Old 01-17-2013, 05:35 AM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
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}')
 
Old 01-17-2013, 10:02 AM   #4
Big_D
LQ Newbie
 
Registered: Jan 2013
Posts: 2

Original Poster
Rep: Reputation: Disabled
Awesome, thank you so much!! This will save me tons of time going forward.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
what exactly does this line of data mean for linux output newbielinuxoperator Linux - Newbie 1 04-29-2011 05:29 PM
how to output data from an instrument in linux? wikiiiii Linux - Hardware 9 08-25-2009 09:58 AM
Help on my Linux Homework ! bash shell script / input-output data etc Bebelindo Programming 2 03-03-2009 01:51 PM
Tweaking internal 56k modem for better data throughput in MEPIS craftybytes MEPIS 10 01-25-2006 10:44 PM


All times are GMT -5. The time now is 04:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration