Eliminate unwanted data

Hi,

I am stuck on writing a script that reads a file, retains wanted data but discards unwanted data from a CSV file.

This is a sample of my table {not the actual data)

ID Color tel_num Name color2 color3
abcdef green 5551212 jj88 red blue
acbdfe yellow 5552121 88jj blue red
fecdab pink 5556666 34jj black red
fcmlab pink 5556767 78ab black red

I need to keep the green, red and black while eliminating the rest.

thanks

egrep '(green|red|black)' stuff_in > stuff_out

Okay - it would help if you posted desired output - plus your csv file example is not a csv format - no commas foir example - we cannot tell "fields" apart.

Thanks for replying. Here is the data again, and I need to export the same file with anything containing "BIO" "PPN" "PNN" "FNN" "NPF" "BCC"

Thanks

dept,course1,course2,course3,course4,course5,course6
CHEM,BIO540,BIO541,BIO16B,MYF17B,SOC203,
BIOL,BIO401,BIO402,BIO910,BIO976,ENG101,SOC633
Math01,BIO25B,MPM21B,MPM22B,MPM26A,,
CHEM,FFN134,FFN509,MERG42B,NPF562,,
Phy01,BDC810,CSPN101,ENG108,,,
GEO001,ENG208,WSO121,WSO199,SCI319,,
Math01,ENG112,BIO540,BIO541,BIOM16C,PLM17C,
Math01,PPN32B,MIL32B,MPF35B,,,
Phy01,BIO604,ENG913,ENG108,HST540,,
Phy01,BIO401,BDL302,BCC134,BIO985,ENG224,PHL206
CHEM,PNN33B,DRA301,DRA42B,PNF36B,GER510,
GEO001,INP900,WSO301,WSO56B,WSO57B,PHL605,
CHEM,FRN631,MYF301,BIO42B,MPF35B,MUS31B,PHL611
GEO001,HST681,WSO301,WSO310,WSO50B,PSY124,
Phy01,BIO201,BIO202,BDG210,BDG211,ENG208,POL208
GEO001,HST604,HST681,WSO301,WSO51B,WSO53B,
IM003,PPN543,PPS42B,PPF549,,,
GEO001,ENG631,WSO112,WSO62B,SOC25B,,

ok -

grep -v  -e "BIO" -e "PPN" -e "PNN" -e "FNN" -e "NPF" -e "BCC" inputfilename > outputfilename

Thank you!