This little shell script came in handy today:
grep 'query' ./sitemap.xml | awk '{ print $2}' | grep src | sort | uniq | sed s/src=\"// | sed s/\"//
I used to to list all the queries in my sitemap.xml file. With that information, I was able to compare it with a list of files in my query directory.Why did I want to do this? I wanted to make sure that the queries I had were all being used. I had thought there was a possibility that I had stopped using a file, but not removed it from the repository. I had not in fact, so that is good!
UPDATE: A more comprehensive script, to be run from apps/appname/:
#!/bin/bash
grep 'query' ./sitemap.xml | awk '{ print $2}' | grep src | sort | uniq | sed s/src=\"data\\/sql\\/// | sed s/\"// > /tmp/sitemap_sql_file_references.txt
ls -1 data/sql/ > /tmp/sql_files.txt
diff /tmp/sitemap_sql_file_references.txt /tmp/sql_files.txt
rm /tmp/sql_files.txt /tmp/sitemap_sql_file_references.txt