The system profiler can be called from the command line:
system_profiler | more
That will give you all the same info. If you want to just extract the serial number of a particular device out, you could use a combination of other standard commands like grep or awk to filter it down to what you want.
Do a "man system_profiler" for more info on the command line version of it.
Edited to add:
Here's an example of a one-line unix command that finds the serial number of my USB hard drive enclosure:
system_profiler | grep -A 10 "Product ID: 0x2329" | grep "Serial Number"
It returns:
Serial Number: 9545FFFFFFFF
In this case, I know the product ID of the usb enclosure, "0x2329". You can find the product ID of your USB key in system profiler and then just use that in the unix command. You could also use the vendor id, or product name, or whatever other common identifier you wanted to grab onto.
__________________
She who laughs last -- probably made a back-up.