I came from a household with three smokers (at least, depending on who visited) who smoked 100% indoors.
This, naturally, posed a problem when we moved into a clean-smelling house, especially since neither of us are smokers.
Google searches and Instructables searches for removing such odors were for small quantities or for rooms, and I couldn't find anything for doing hundreds of books in a short amount of time.
I wracked my brain, packed with limited household skills (so far) and hit upon an idea.
Back when I had gerbils, years ago, I used cedar shavings as bedding. While most pet stores and pet professionals will strongly advise against using cedar shavings for bedding for rodents these days, there was a side effect that I was most interested in taking advantage of.
Back then, cedar shavings made my bedroom smell absolutely wonderful.
I hopped in the car and drove out to a nearby chain pet store and picked up a 2 cubic foot package of cedar shavings for under 12 bucks.
If you have access to cedar chips or shavings from somewhere else, you could save yourself the gas and cost of the purchased package.
Also, I wanted her empty boxes for this project.
After opening the package of cedar shavings, I spread a thin layer of shavings on the bottom of an empty box.
Then I stacked books (and eventually CDs and DVDs) on their long end. Not the binding side, but the flippy page side. I let it sit for an hour or so, but it wasn't quite working.
It took 3 tries with alternating the depth of the shavings for an optimal scent removal. I discovered that between 1/4 and 1/2 an inch worked well, as long as I closed the box lid.
For DVDs and CDs, I ended up either slightly popping the case open, or in the case of multiple DVD sets, removing each specific DVD case from the set box and setting them inside.
After a minimum of an hour (longer for the DVD sets and hardback books) I put the "deodorized" objects into an empty, non-stinky box (as we haven't received delivery of the shelves for them yet.)
The cedar shavings didn't have to be replaced often; in fact, two of the boxes still have their original layers. If you can't smell the semi-pungent cedar smell, they should be replaced.
All told, I did over 400 books, 200 DVDs, and around 150 CDs, rotating in and out of 4 boxes with the layer of shavings, in about 9 days.
When removing the objects from the box, simply shake off the shavings. If necessary, thumb the pages of the book to flip little pieces out. I was doing 3-5 paperbacks at a shot like this.
Regarding the "expired" shavings, those that aren't smelling so good any more, you could conceivably trash them, use them for fireplace kindling, compost it, use it as a mulch additive, or a number of other things, I'm sure.