I used the /clear command, and I accidentally got rid of a very important book. Is there a way to get it back without having to rewrite it?
You can try crashing/killing Minecraft as soon as possible after that happens by either holding down F3+C for 10 seconds or stopping
javaw.exe in the task manager. Do not use the "X" icon or Alt+F4, since that triggers saving.
If you're really lucky, no autosave happened between your command and the exiting, that would mean that your inventory (and everything else in the world) resets to the state it was a few seconds ago.
In addition to the previous answers, I'd like to give you a preventive measure:
Make use of the saved hotbars if you have an important item you don't want to loose. You can get back your saved hotbars at any time while in creative mode. Just make sure you don't override the important one.
To access saved hotbars, use X+number (load) or C+number (save) respectively.