I've got accumulated data in a CSV file as follows:Parameter_1,Parameter_2,Parameter_3,Parameter_4,Parameter_5,Parameter_6Parameter_1,Parameter_2,Parameter_3,Parameter_4Parameter_1,Parameter_2,Parameter_3,Parameter_4Parameter_1,Parameter_2,Parameter_3,Parameter_4,Parameter_5Parameter_1,Parameter_2,Parameter_3,Parameter_4Parameter_1,Parameter_2,Parameter_3Parameter_1,Parameter_2,Parameter_3,Parameter_4Parameter_1Parameter_1,Parameter_2,Parameter_3,Parameter_4How can I just read the the lines which have 4 or more parameters i.e:Parameter_1,Parameter_2,Parameter_3,Parameter_4,Parameter_5,Parameter_6Parameter_1,Parameter_2,Parameter_3,Parameter_4Parameter_1,Parameter_2,Parameter_3,Parameter_4Parameter_1,Parameter_2,Parameter_3,Parameter_4,Parameter_5Parameter_1,Parameter_2,Parameter_3,Parameter_4  X Parameter_1,Parameter_2,Parameter_3 X DO NOT READ THIS because it has less than 4 parametersParameter_1,Parameter_2,Parameter_3,Parameter_4  X Parameter_1 X DO NOT READ THIS because it has less than 4 parametersParameter_1,Parameter_2,Parameter_3,Parameter_4Ideally I would like to read lines which have more than X parameters and less than Y parameter - ie not read it if it has too many parameters in a given lineQ: How can this be written in BASH??A: [Should] the code look like this:number_of_parameters=`$line | sed 's/[^,]//g' | wc -c` #where $line is the line thats being currently readif [ number_of_parameters -gt X ] && [ number_of_parameters -lt Y ]then     ... do somethingfi
How to count the number of parameters in a given line within a CSV file
bash;csv simple
Use grep for a much simpler solution. grep -E '^(.*,){3}' my_csv_file.csvSince 4 parameters or more will have at least 3 commas, hence the 3 in the regex.(.*,) will match a parameter followed by a comma. .* means match any char (.) 0 or more times.Here's another approach to have the values in a variable:my_var=$(grep -E '^(.*,){3}' my_csv_file.csv)echo $my_varMake sure you have  around $my_var otherwise you will lose the newlines.