Sublime Text 2 stores the files in ~/Library/Application Support/Sublime Text 2/Settings , in the .sublime_session files that are there.
The contents of these files are a large piece of JSON containing separate tabs. Find the file name / tab name / keyword in the document in the file and you can get what you need.
For Sublime Text 3, use the following path:
~/Library/Application Support/Sublime Text 3/Local/Session.sublime_session
Credit: eebbesen
mcw0933
source share