[dev] [query] A tool for filtering lists of filenames with return codes

From: Eric Pruitt <eric.pruitt_AT_gmail.com>
Date: Thu, 19 May 2016 17:09:55 -0700

I wrote a tool for filtering lists of files based on return codes of
subprocesses called "query:" https://github.com/ericpruitt/query .

Find all dynamically linked executables:

    find -type f | query sh -c 'ldd "$QUERY_FILENAME"'

Find all files ending in ".json" that are malformed:

    find -type f -iname '*.json' | query -s ! python -m json.tool

The tool should pretty portable. I haven't tested it on FreeBSD or
OpenBSD yet, but I was able to compile it on Mac OS X. I am using
signal(2) whose behavior varies across platforms, but I don't think that
will be a problem in practice since the handler only calls exit(3).
Please let me know what you think of the idea and code.

Received on Fri May 20 2016 - 02:09:55 CEST

This archive was generated by hypermail 2.3.0 : Fri May 20 2016 - 02:12:10 CEST