I have data something like this:
# c1 c2 c3
23 b 323
23 g 54
23 a 11
23 c 1
23 d 0
23 e 397
23 f 40
24 b 23
24 g 24
24 a 113
24 c 12
24 d 10
24 e 7
24 f 50
In general, you must do the filtering outside of gnuplot, in order to have lines connecting the filtered points.
If you know all values which can appear in the second column, you can use the solution given in Plotting multiple graphs depending on column value with gnuplot.
If you don't know the possible values, you can extract them with
c2s = system("awk '!/^#/ { print $2 }' test.dat | sort | uniq")
and then plot them with
plot for [c2 in c2s] sprintf('< grep ''\b%s\b'' test.dat', c2) using 1:3 with lines title c2