[File] "file" as a type filter

raf file at raf.org
Sun Jun 21 21:32:12 EDT 2026


On Sun, Jun 21, 2026 at 11:45:20AM -0700, Gordon Messmer <gordon.messmer at gmail.com> wrote:

> On 2026-06-21 6:11 AM, Christos Zoulas wrote:
> > Sure, but you can use -f to supply the list of files and use --mime-type
> > to just print the mime-type and use egrep to select the mime times you
> > want.
> 
> 
> You can, and that *might* be good enough for this use case, but we're still
> talking about a byte stream where records are newline delimited but might
> contain newlines, and fields that are colon separated but might contain
> colons.
> 
> It would be a lot more reliable if the input was a stream of NUL separated
> records and the output was a stream of NUL separated records.

This xargs+rh command would do that:

  xargs -0 rh -0e '"*ELF*".what'

cheers,
raf



More information about the File mailing list