How to find files that only contain alphanumeric characters and [áéíóúñ.,¿?¡!()]?
I have some sparse plain text files and I need to separate them from scripts and any other thing, they're just poetries in spanish so it's unlikely that the contain [#></:] for example. I came with
sudo find . -type f -not -path '*/.??*/*' -exec file {} \; \ | grep ": Unicode text, UTF-8 text"$ \ | cut -d: -f1 \ | while read file; do grep -iv '[a-z0-9\.\/_\-áéíóúñ]' "$file" || echo $file done but it matches lines and I need to match the entire file.
Edit: At least what worked for me was:
sudo find . -type f -not -path "*/.Trash-*/*" -not -path '*/.??*/*' -exec file {} \;| grep ": Unicode text, UTF-8 text"$| cut -d: -f1| while read file do grep -ivq "^[a-z0-9\.\/_\-\ \,\"áéíóúñ\!¿¡?\(\)]*$" "$file"|| echo "$file">>/tmp/textlocation ; done The trivial solution of adding ^ and $ did the difference. The -L solution listed here may work and is more elegant but mine solution did the job.