Good question as I also ran into some files not remembering for which purpose or which material I printed these. The online G-code visualizers do not display the temperature or the correct filament width, so basically that won't help you (unless you modify the open source programs...). Reading from firmware would not be possible without adding a new feature, as far as I know, this is not implemented in Marlin Firmware or in Prusa firmware (which is based on Marlin).
When using a printer server like OctoPrint, you can store your G-code files in a folder structure that you can define yourself; so basically create a directory structure based on the material type, brand, etc.
However, it is relatively easy to write a small program in Python to read a file and interpret the lines (even if you're not a programmer). There are lots of tutorials and examples to find to open files read the file e.g. line by line and detect strings to identify the settings for G-codes M104/M109 (hot end temperature) and M140/M190 (bed temperature). Usually you slice your models with a specific set of bed and hot end temperature (which you know), so basically you can find out which material was meant to be printed with the G-code file. You could even let the program sort the files for you by moving them into separate folders.
I'll add it to my list of things I'd like to do some rainy day! :)
Note that some printers use different, or even custom G-codes to control bed temperature; e.g. when reading Ultimaker 3 G-code files you cannot see the bed temperature!
{Machine+State}_{FileName}_{YYYYMMDD-TTTT}_{FileID}.gcode
, for example,UM2+PLA8_NozzleMag_20160911-1520_ym9450.gcode
$\endgroup$