Sort within VI with parameters

Jay Strauss <[email protected]> Thu, 23 Jun 2011 14:59:47 -0500
Newsgroups gmane.org.user-groups.luni.tech
Message-ID <[email protected]>
Hello,

I want to sort a file within VIM using some sort parameters (i.e. I
want to sort by the second column where my columns are | delimited)

I can't figure out the proper incantation

<esc>:%!sort -t| -k2,2

I get an error like:
'-k2' is not recognized as an internal or external command,
operable program or batch file.

I can't figure out the proper quoting or escaping needed to pass the
parms to sort without VIM getting mad.

Some sample data is:
# Value|Alternate Value
CHR|DC
NTR|DO
GST|GI
FEM|LC
NUR|NP
OPT|OD
RHB|OT
NUR|PA
RHB|PT
NUT|RD
NUR|RN
PHR|RX

Thanks
Jay
-- 
Linux Users Of Northern Illinois (Chicago) - Technical Discussion 
http://luni.org/mailman/listinfo/luni