Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a comma-delimited giant file that was exported from a database. The file has this format

10-Jan-2000,344,13,21,2,55,3,"rose garden" ,3444,32
11-Jan-2000,324,3,1,21,5,23,"space green fox" ,3444,11
12-Jan-2000,34,23,31,22,5,34,"bourbon mars" ,3444,88

Notice that the color field is surrounded by quotes and has a space at the end. Don't ask me why.

I would like to end with a file that is just this:


what magic command should I type on terminal to get rid of the date, color, type and reference on all lines of that txt file?

share|improve this question
cut -d, -f2-7 – Stéphane Chazelas Jan 18 '14 at 18:22
man, I love you. You are a genius!!!!! Please add this comment as an answer! – SpaceDog Jan 18 '14 at 18:31
FYI, the format is called CSV (Comma Separated Values). – goldilocks Jan 18 '14 at 18:32
@goldilocks, thanks! – SpaceDog Jan 18 '14 at 18:33
up vote 4 down vote accepted
cut -d, -f 2-7 filename


awk -F, '{OFS=","; print $2,$3,$4,$5,$6,$7}' filename
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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