2

I need to sort a csv file containing a header using Vim commands.

I currently have to following command (which uses the external sort):

:%!sort -t ',' -k9,9 -k8,8 -k10n -k2n -k3n -k4n -k5n -k6n -k7n

which works, but I need to be able to ignore the header line, which looks like this:

Customer Complaint,Date,City,State,Zip code,Solved

Is there any way to do this with Vim commands?

1 Answer 1

4

You can do:

:2,$!sort -t ',' -k9,9 -k8,8 -k10n -k2n -k3n -k4n -k5n -k6n -k7n

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.