Use `psql -A` instead of yet another `grep`
Use SQL-based filtering instead of grep
Have the list sorted by default
Add second optional parameter for additional filtering.