(There might be an easier way, but I haven't seen any on these forums.)
First, you'll need Notepad++.
After downloading, open it up and make sure you have the TextFX plug-in.
If you don't, go into the plugins manager, and install it from the list of available plugins.
After that, search the database for a group of items that you want to buy from. This is what I searched for:
Yeah, not the best search for a list, but it'll do for purposes of this guide.
So you'll see something like this (depends on what you searched for):
Like the image says, click somewhere around the left of the first image.
Scroll down to the bottom:
Shift click where indicated to select all the items on the page.
Now copy and paste it into Notepad++:
Repeat with how ever many pages you desire (I went up to the 4th page, 400 items total):
Press Ctrl+A to select everything in Notepad++:
Then go to the option specified in the picture to delete all the blank lines.
Afterwards go to this option (Make sure you don't deselect everything; if you do, just press Ctrl+A again):
This sorts all the lines alphabetically, spaces before numbers, numbers before letters.
Time to delete the useless stuff! The pictures are pretty self explanatory.
Be careful if you have items with numbers as the first character (some items like books do).
They're usually pretty noticeable, but you wouldn't want to delete them.
And do the same with the profit:
Of course, this guide is useless for advanced members.