After opening a big csv file in gvim, how can I know how many columns are within this file?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A quick dirty hack would be to do something like:
Which would give you the number of commas on a single row. Add one and you have your number of columns (assuming no trailing comma, of course).
I say this is quick and dirty because it doesn’t take into account quoted columns which can contain commas. I’m sure there might be a way to take that into account with a regex but it’s probably not trivial.