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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I sort (arrange) content of

Status
Not open for further replies.

dsm325

Technical User
Apr 4, 2001
29
0
0
US
How can I sort (arrange) content of a file nmerically while in vi:
245AL1I * "*" /data/ceunix/stage
H046LIB * "*" /data/ceunix/stage
H250Mc1I * "*" /data/ceunix/stage
H241COVO * "*" /data/ceunix/stage
H241ASTO * "*" /data/ceunix/stage
H241GEOI * "*" /data/ceunix/stage
H241GE1O * "*" /data/ceunix/stage
H243CC5I * "*" /data/ceunix/stage
H243CC8I * "*" /data/ceunix/stage
H100PUTI * "*" /data/ceunix/stage
H100GOLI * "*" /data/ceunix/stage
H243WESI * "*" /data/ceunix/stage
H244TRWI * "*" /data/ceunix/stage
H046WAKI * "*" /data/ceunix/stage
H243PHEI * "*" /data/ceunix/stage
D220SOU * "*" /data/ceunix/stage
H243FIDI * "*" /data/ceunix/stage
H533CMI * "*" /data/ceunix/stage
H243SBCI * "*" /data/ceunix/stage
H243IMSI * "*" /data/ceunix/stage
D220BIS * "*" /data/ceunix/stage
H250APSI * "*" /data/ceunix/stage
H139ENGI * "*" /data/ceunix/stage
H245PUTI * "*" /data/ceunix/stage
H244NATI * "*" /data/ceunix/stage
D220BSCI * "*" /data/ceunix/stage
D220BSY * "*" /data/ceunix/stage
H250EMS * "*" /data/ceunix/stage
H244BANI * "*" /data/ceunix/stage
H244BA1I * "*" /data/ceunix/stage
H244BA2I * "*" /data/ceunix/stage
H244BAT * "*" /data/ceunix/stage
H243IMSO * "*" /data/ceunix/stage
H243AONI * "*" /data/ceunix/stage
H243MDOI * "*" /data/ceunix/stage
H243EPXI * "*" /data/ceunix/stage
H243MD2C * "*" /data/ceunix/stage
H244AME * "*" /data/ceunix/stage
H243IBRI * "*" /data/ceunix/stage
D220ALXI * "*" /data/ceunix/stage
H244NATI * "*" /data/ceunix/stage
D220FSOI * "*" /data/ceunix/stage
H243ALI * "*" /data/ceunix/stage
 
1) make on all entries the same format
prepend _ to the lines beginning by [0-9]
:%s/^[0-9].*/_&/
2) enter
:%!sort -k 1.2
3) delete the inserted _
:s/^_// -----------
Ohne Intelligenz bist Du ein Fiasko,
ohne Technik ein Amateur und
ohne Herz eine Maschine.

[ Wladimir Horowitz ]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top