We really need to see the input data, at a minimum, if you want proper help from us.
Please give us an example of the contents of the file, and point out what you need from it, in detail. Also post the function code you wrote, if possible. And what does the $occ
At the very least, this...
array=( $(grep "$occ" .eventi.txt) )
...breaks the output of grep
into one array element per whitespace-delimited* "word". If you quote the whole "$()", then the entire output will be treated as a single entry.
(*Unless you've reset the IFS environmental variable in some way, then it will split on whatever characters it contains.)
Safe processing would probably require another read
loop or similar. But again we need to see what the input looks like.