how to change this looking for mimetype "text/plain" instead of extension *.txt?

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

  1. The problem statement, all variables and given/known data:

Create a Shell script that looks for all text files in your home directory (including subdirectories).
List only text files that all members of your group are able to "read and write".
These files shall be listed in the order "date of last change on file".
The permissions on and the full path of each file shall be listed, too.

  1. Relevant commands, code, scripts, algorithms:

  2. The attempts at a solution (include all code and scripts):
    This is my solution (until now):
    Here I'm looking for the file's extension "*.txt" but actually I've to look for the mime-type or so. Therefor the "file command" exists but I've no idea to adopt the mime-type into my script instead of the extension's search?

#! /bin/bash
 
 
 
 find ~ -name "*.txt" -printf "%M %f %TY%Tm%Td%TH%TM%TS %TY %Tm %Td %TH %TM %p\n" | sort -nk3 |
 awk '/^....rw/{
 
 filecnt = filecnt + 1
 printf ("No. %s", filecnt);
 printf ("  ***  filename: %s", $2 )
 printf ("  ***  filerights: %s", $1);
 printf ("  ***  last change on: %s.%s.%s um %s:%s h\n",$6, $5, $4, $7, $8)
 printf ("  ***  file path: %s\n", $9); 
 
 printf ("\n");
}'

  1. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
    HAW Hamburg, Hamburg (Hamburg), Germany, Schneider, BS,http://ds2.etech.haw-hamburg.de/snd/veranst.html

Many files have text internally, and I am not sure there is a magic for plain text, so file might not be that useful. I actually wrote a pctbin C command to find out what percentage of characters were not in the common ASCII text file set: ' ' through '~', line feed, carriage return, form feed. The trick is figuring out what your professor defines as text!

You can find * -type f | xargs -n999 file and see all the types you have, and write a grep -E pattern that will select or deselect so only text types survive. You can use sed to remove the suffix of ": file type".

The permission are visible in find -ls or ls -l, and you can grep for them, too. Sorting by date is easy with ls -t, but ls has a file count limit. If you use the date, watch out for ls -l having a date-time form for one year and then a date-year form. I wrote a trivial C to take a stream of file name lines and spit them back out prefixed with the mtime.

Hope this helps!

you can use file command's -i option. or --mime-type

What Operating System and version are you running? It really matters for this type of question because there are extensions to standard unix commands available in some versions of Linux which could help.

uname -a