I could write a simple program for this in a programming language I know (or just terminal, I suppose), but is there a simple way to do this in LaTeX?

Maybe this could be done in LuaLaTeX? The regex to get the reference types is just `@.*\{` (at least in Sublime Text).

I have entries like `@online` and `@article` but I don't know which ones I have and which ones I don't and my bibliography file is pretty big. I want to make a reference list that is sorted per type, but in order to do that I need to know what article types I have first!

I found a way to do it in Sublime (copy/paste bib file in Sublime --> select all with the regex `@.*\{` --> alt + enter --> go to edit --> permute lines --> unique), but I am still leaving the question open for a (Lua)LaTeX style answer.

Now I can do it as stated in [Sectioning bibliography by type of referred item](https://tex.stackexchange.com/questions/20246/sectioning-bibliography-by-type-of-referred-item)

I currently have to type:

```
\printbibliography[type=article,title={Articles}]
\printbibliography[type=inproceedings,title={Conference papers}]
\printbibliography[type=book,title={Books}]
\printbibliography[type=inbook,title={Book Chapters}]
\printbibliography[type=incollection,title={Chapters in a Collection}]
\printbibliography[type=MastersThesis,title={Master Theses}]
\printbibliography[type=techreport,title={Tech Reports}]
\printbibliography[type=misc,title={Misc}]

```

Which is fine but I am still wondering how one can do it more automatically.