How to combine multiple tags in a search


#1

As a novice user in Unix and Scripting, I am finding it hard going on searching for multiple tags and search terms in a document. Typically I would like to find say 2 or more tags with or without text searching and probably with exclusions too of other tags and text.

I have so far not been able to understand the node syntax sufficiently well and the queries that were possible with Taskpaper v2 are not supported.

For example, how to find in a document the lines with tags @review AND @overdue but excluding @waiting and containing the text ‘Legacy’. This is just an example (probably not actual) but that is the sort of thing I am after, combining text searches with tags and returning the parent level and matching children.

My current poor solution is to use BBEdit with multi file search and some grep, then open up the files in FT.

Many thanks.


Mark


#2

Let’s build it up by stages:

  • Lines at any outline level containing legacy

//legacy

  • Let’s add some more conditions
//(legacy and @review and @overdue)
  • Now let’s look at a different harvest, first those that do contain waiting. Again for any outline level we prefix with // (for just the top level we would use a single slash /).

//@waiting

  • And finally, let’s combine those two harvests with a set operator
//(legacy and @review and @overdue) except //@waiting

#3

Alternatively, just combine two sets of conditions in a single harvest:

//(legacy and @review and @overdue) and (not @waiting)

#4

This is working, thank you very much - much easier than I thought too, I was adding all sort of slashes and asterisks!

I suppose the next question is how to get the same type of lines returned but in more than one document, as I have not been able to get the CLI command working.

Thanks again.


#5

Any ideas please on getting a list of tagged lines from multiple files without using CLI command (which I can’t get to work)?

Even a regexp that works would be good but I am struggling here (using BBEdit which gives me multi file searching).

I am looking to get as an example all lines as complexpoint showed me above, that is including one or more tags, but excluding others like @done or @low. Does this have to be a script or can regexp do it?

Many thanks.

Potential if long winded solution is to insert a whole folder of file’s contents into BBEdit, copy /paste into a new FT document then do a node search , but if it doesn’t going me the project or heading context, it would only be a partial solution !