Click here for important information about

Getting specific columns in csv file

February 11, 2010 at 18:41:29
Specs: Windows XP
I have several big csv file that have 48 columns. From these, I only need 5 of them -- columns 6,7,14,18,31.
Is there a way I can automate this and putting it in a new file? Hope it could be via a dos script or something.

See More: Getting specific columns in csv file

February 14, 2010 at 01:26:19
jecmac, I'd think it's gonna be somewhat tedious to set up since there are so many values involved, but seems to me that you need simply to designate the # item in the CSV file you desire and your machine can fetch it (at machine speed, FAST!). Perhaps designate a specific item by # and then fetch a range of values?
Ed in Texas.

Report •

February 14, 2010 at 06:51:27
DOS can do it, if the file is a bit "readable" ... meaning that it is a textfile, not a binary file (eg. Excel, Word, ...)

BUT ... you should post this (or a similar) thread in the "programming" forum, they'll be happy to help you

Report •

March 11, 2010 at 20:16:58
Use the following command

awk -F"," '{print $6,$7,$14,$18,$31.}' your_file.csv

Report •

Related Solutions

March 12, 2010 at 00:46:19
Try this:

@echo off
for /f "tokens=1-31 delims=," %%A in (your_input_file.csv) do (
        echo %%F,%%G,%%N,%%R,%%_>>your_output_file.csv

Report •

March 12, 2010 at 01:49:58

Thanks a lot!! Worked great!!

Report •

March 12, 2010 at 02:20:43
You're welcome, thanks for coming back to advise about your successful outcome.

Report •

Ask Question