I figgure it could be done by making a table with the names, and finding a way to split the names in parts.

such as

chickens_con_caso
chickens_with_rice

if there was a way to split up spacing and other forms of none needed things that'd be understood as a space in a file name (such as space,_,comma,.,etc) .

Thus if i'm correct it should give something like:

is there common first words in the files? yes
chickens
there for:
chickens == chickens { it's a group make the dir }
is chickens in $2? no { make new subdir move the file there }
check for 3rd chicken in first word of files, if so go back to chickens == chickens , continue on with other new groups

ending in:
chickens/con/chickens_con_caso
chickens/with/chickens_with_rice

so i'm thinking, make a table with info of the files.
split the files up in a new table, use the first one to make commands move and make new DIR (cause it has the files location and real names. )

but maybe i'm in over my head?

edit: table = hashtable