sort multipath sectional data


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sort multipath sectional data
# 1  
Old 01-20-2010
sort multipath sectional data

Hi all,

I'm running a command on an ESXi server and the output for multipath device info is not in order. Can any of you SED or AWK gurus show me how I might sort the sectional data where both LUN paths are in order?

Output:

fc.20000000c9799e9a:10000000c9799e9a-fc.2001000402fc546c:5000402001fc546c-naa.6000402001fc546c637e40a300000000
Runtime Name: vmhba2:C0:T7:L61
Device: naa.6000402001fc546c637e40a300000000
Device Display Name: NEXSAN Fibre Channel Disk (naa.6000402001fc546c637e40a300000000)
Group State: active
Storage Array Type Path Config:
Path Selection Policy Path Config: {current: no; preferred: no}

fc.20000000c9799e9a:10000000c9799e9a-fc.2001000402fc546c:5000402001fc546c-naa.6000402001fc546c637e40e200000000
Runtime Name: vmhba2:C0:T7:L62
Device: naa.6000402001fc546c637e40e200000000
Device Display Name: NEXSAN Fibre Channel Disk (naa.6000402001fc546c637e40e2
Group State: active
Storage Array Type Path Config:
Path Selection Policy Path Config: {current: no; preferred: no}

fc.20000000c9799e9a:10000000c9799e9a-fc.2001000402fc546c:5000402101fc546c-naa.6000402001fc546c637e40a300000000
Runtime Name: vmhba2:C0:T5:L61
Device: naa.6000402001fc546c637e40a300000000
Device Display Name: NEXSAN Fibre Channel Disk (naa.6000402001fc546c637e40a300000000)
Group State: active
Storage Array Type Path Config:
Path Selection Policy Path Config: {current: yes; preferred: yes}


What I'd like to see:

fc.20000000c9799e9a:10000000c9799e9a-fc.2001000402fc546c:5000402101fc546c-naa.6000402001fc546c637e40a300000000
Runtime Name: vmhba2:C0:T5:L61
Device: naa.6000402001fc546c637e40a300000000
Device Display Name: NEXSAN Fibre Channel Disk (naa.6000402001fc546c637e40a300000000)
Group State: active
Storage Array Type Path Config:
Path Selection Policy Path Config: {current: yes; preferred: yes}

fc.20000000c9799e9a:10000000c9799e9a-fc.2001000402fc546c:5000402001fc546c-naa.6000402001fc546c637e40a300000000
Runtime Name: vmhba2:C0:T7:L61
Device: naa.6000402001fc546c637e40a300000000
Device Display Name: NEXSAN Fibre Channel Disk (naa.6000402001fc546c637e40a300000000)
Group State: active
Storage Array Type Path Config:
Path Selection Policy Path Config: {current: no; preferred: no}

fc.20000000c9799e9a:10000000c9799e9a-fc.2001000402fc546c:5000402001fc546c-naa.6000402001fc546c637e40e200000000
Runtime Name: vmhba2:C0:T7:L62
Device: naa.6000402001fc546c637e40e200000000
Device Display Name: NEXSAN Fibre Channel Disk (naa.6000402001fc546c637e40e2
Group State: active
Storage Array Type Path Config:
Path Selection Policy Path Config: {current: no; preferred: no}



Thanks,

Stovie1000
# 2  
Old 01-20-2010
So which lines are LUN paths? Line 1 and 3 in every section?
# 3  
Old 01-20-2010
The LUN path would be the second line; however, I would need all the info from each section starting with the fc line and ending with the Path Selection line.

I would just like to see both paths for the same LUN IDs and there sectional info follow each other instead of being randomly displayed from the output.
# 4  
Old 01-20-2010
Guess there is no "|" in your file. (or you can replace it by any character which is not appear in your file.)

Code:
awk '{printf (/^$/)?$0"\n":$0"|" }' urfile |sort -t\| -k2  |tr "|" "\n"

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

HELP on 'sectional' or 'group' sorting

Hi, I need to do some section/group sorting. At the moment, I get around it by grep group by group and then re-directing to the same 'final' output file. Below is what's been sorted so far based on the second field $ awk -F"," '{ { print $5 " == " $6 } }' /tmp/x.csv | grep -v "^env" | grep... (2 Replies)
Discussion started by: newbie_01
2 Replies

2. Shell Programming and Scripting

Need to sort out data

Hello All, I have one file with multiple lines records like as below.. I need to extract only BFG and corresponding BSG record/line. for evry BFG there is one BSG record is there as mentioned in BOLD and so on... BFG BR 00001 20140724 000 000 ? ? BLG UVR QPR 01 380 ? ? 999 0 0 0 ? BLC... (2 Replies)
Discussion started by: Riverstone
2 Replies

3. Shell Programming and Scripting

Sort data As per first Column

hI I have file A NSU30504 5 6 G 6 NSU3050B T 7 9 J NSU30506 T I 8 9 NSU3050C H J K L Output: NSU3050B T 7 9 J NSU3050C H J K L NSU30504 5 6 G 6 NSU30506 T I 8 9Video tutorial on how to use code tags in The UNIX and Linux Forums. (13 Replies)
Discussion started by: pareshkp
13 Replies

4. UNIX for Dummies Questions & Answers

sort data

Hi, I need to filter the output of a command and display certain data only. How can i do this ? My file contain: $ cat abc.txt <testcase title="AAA_100"> <testcase title="BBB_200"> <testcase title="CCC_300"> <testcase title="DDD"> ... (3 Replies)
Discussion started by: crazydude80
3 Replies

5. Shell Programming and Scripting

Sort Data by Group !

Hello, I have a file and i want to sort by third column and extract the three top lines of each group, it is determined by the second column (144, 89, 55, etc). Could you please help me with the appropiate awk shell script XLY-XLP 144 0.592772 XLY-XLE 144 0.798121 ... (3 Replies)
Discussion started by: csierra
3 Replies

6. Shell Programming and Scripting

Help needed to sort data

Hello All, Today i have been asking lots of question, hope to become good in scripting soon with all the wonderful advices i get. The question is i want to sort data a get uniq string from it. The code i am using to generate the output is:- check_sun() { for i in $SUN_PLATFORM do $ECHO... (0 Replies)
Discussion started by: asirohi
0 Replies

7. Shell Programming and Scripting

Trying to sort data

Im trying to sort all this data. I need to get a list out of the data (websites) and just list them out can anyone point me in the right direction. Im working with dans guardian. 2009.6.10 6:26:50 - 192.168.42.200... (5 Replies)
Discussion started by: darknirvana
5 Replies

8. UNIX for Advanced & Expert Users

sort out the required data

Hi All, I have a file 1.txt which has the duplicate dns entries as shown: Name: 000f9fbc6738.net.in|Addresses: 10.241.66.169, 10.84.2.222,212.241.66.170 Name: 001371e8ed3e.net.in|Addresses: 10.241.65.153, 10.84.1.101 Name: 00e06f5bd42a.net.in|Addresses: 10.72.19.218,... (6 Replies)
Discussion started by: imas
6 Replies

9. Shell Programming and Scripting

Sort complex data

Hi, Can someone here help sorting the following data in numeric order? INPUT: FIRST abc(3) def(13) fgh(1) ijk(6) abc(2) SECOND dfe(10) abc(4) hij(19) tlm(1) hij(1) hub(10) abc(1) fed(3) OTHERS hij(10) mok(4) bub(19) hij(1) abc(2) abc(15) abc(1) hij(3) OUTPUT: FIRST def(13) ijk(6)... (12 Replies)
Discussion started by: need_help
12 Replies

10. Shell Programming and Scripting

sort data

Hi! I'm trying to sort a file.dat with the sort command. The data contained by file.dat is similar to the data set below: 100.000 99.000 110.000 55.000 113.000 33.000 25.000 9.000 15.000 It is relatively easy to sort the data in ascending or descending order, but the problem is... (11 Replies)
Discussion started by: bjorb
11 Replies
Login or Register to Ask a Question