Sample Header Ad - 728x90

Help in understanding a command line search of all sqlite files on os x device

1 vote
1 answer
261 views
I was listening to a [Talk Python To Me](https://talkpython.fm/episodes/show/299/personal-search-engine-with-datasette-and-dogsheep) podcast that had Simon Willison as the guest. Willison discussed two projects he is developing, Datasette and DogSheep Beta, both of which allow you pull in data as an SQLite database (Datasette) and then index and query it (DogSheep Beta). All your data include Apple Watch data, texts, photo data including lat/long and even the scoring Apple uses to rank your photos. The two links here are really interesting and I recommend them. The problem I'm having finding .sqlite files. The directions and the YouTube say to install Datasette and point it against a database on your laptop. I know I can use the Finder for files but I'd like to follow along with youtube. At around 5:31 in his [PyCon AU talk](https://www.youtube.com/watch?v=CPQCD3Qxxik) , he types out:
"kMDItemDisplayName ==*.sqlite" -0 | xargs -0 stat "-f%z %N" | sort -nr | head -n 20
I managed to read the incantation but while I get the gist, there are a number of details that Apple's CLI help pages don't cover. So, here are my questions: * What is the -0 flag, specifically? (as opposed to the overly brief example Apple gives) * What does xargs -0 stat "-f%z %N" mean? * -nr what are the n and r flags for sort? * finally (and you probably guessed it with order) what is -n flag for head?
Asked by hrokr (293 rep)
Jan 29, 2021, 04:15 AM
Last activity: Jan 29, 2021, 02:32 PM