Command-line queries include the Trash
Posted on September 9th, 1997 by shacker
If you run BeOS queries from the command line, be aware that they will include the Trash. The GUI query applet does not do this unless you specifically tell it to, but it can be a problem from the command line, and there’s no way to turn it off. You may want to filter your query results to make sure you’re not working with Trashed items, like this: query "((name=="filename")&&(BEOS:TYPE=="text/plain"))" | sed /Trash/d
See Queries from the Terminal for basics.