How to write a shell script which searches the current UNIX directory and returns the names of all files of type ASCII text?
Tell me more
×
Unix & Linux Stack Exchange is a question and answer site for
users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.
|
|
The best of 2 worlds: Avoids the use of the useless
|
|||||||||||||
|
|
Exec 'file' on all the files in the current directoy, and then grep for 'ASCII':
|
|||
|
|
On CentOS 5, ASCII can mean a lot of things such as "ASCII C++ program text", "ASCII English text", and "ASCII text" so you might need to narrow it down more. |
|||
|
|
|
If it is just the current directory, no need for Just try |
|||
|
|
|
Assume you get directory name as the argument ($1), then,
|
|||
|
|
