Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sort hdiskpower devices

Status
Not open for further replies.

oraytektips

Programmer
Jul 1, 2005
65
US
I tried different things with sort but nothing is working.Can anyone help me sort the power devices in ascending order?

[root]:/ # lsvg -p vgname|grep power|awk '{print $1}'|sort
hdiskpower10
hdiskpower190
hdiskpower3
hdiskpower35
hdiskpower36
hdiskpower37
hdiskpower38
hdiskpower4
hdiskpower41
hdiskpower45
hdiskpower47
hdiskpower48
hdiskpower5
hdiskpower57
hdiskpower58
hdiskpower59
hdiskpower60
hdiskpower61
hdiskpower62
hdiskpower64
hdiskpower65
hdiskpower66
hdiskpower67
hdiskpower68
hdiskpower69
hdiskpower76
hdiskpower77
hdiskpower8
hdiskpower88
hdiskpower9
hdiskpower91
hdiskpower95
 
[tt]lsvg -p vgname|grep hdiskpower|awk '{print $1}'|sort -n -k 1.11
hdiskpower3
hdiskpower4
hdiskpower5
hdiskpower8
...
hdiskpower88
hdiskpower91
hdiskpower95
hdiskpower190[/tt]


numeric sort ([tt]-n[/tt]) on field 1 ([tt]-k 1.11[/tt]), but starting in that field at position 11 ([tt]-k 1.11[/tt])

HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top