BASH: How to count all the human readable files?

Posted by user1687406 on Stack Overflow See other posts from Stack Overflow or by user1687406
Published on 2012-09-29T15:31:21Z Indexed on 2012/09/29 15:37 UTC
Read the original article Hit count: 198

Filed under:
|
|
|
|

I'm taking an intro course to UNIX and have a homework question that follows:

How many files in the previous question are text files? A text file is any file containing human-readable content. (TRICK QUESTION. Run the file command on a file to see whether the file is a text file or a binary data file! If you simply count the number of files with the ".txt" extension you will get no points for this question.)

The previous question simply asked how many regular files there were, which was easy to figure out by doing find . -type f | wc -l

I'm just having trouble determining what "human readable content" is, since I'm assuming it means anything besides binary/assembly, but I thought that's what -type f displays. Maybe that's what the professor meant by saying "trick question"?

This question has a follow up later that also asks "What text files contain the string "csc" in any mix of upper and lower case?". Obviously "text" is referring to more than just .txt files, but I need to figure out the first question to determine this!

© Stack Overflow or respective owner

Related posts about file

Related posts about bash