In the context of a home recording studio (which I'm assuming is what you're working with) the easiest way to get this kind of tone is with a DI box with two outputs. The "go-to" box for this kind of sound is either a Sansamp Bass Driver DI or Para-Driver, but anything you have on hand should do the trick.
Basically, you want to record two channels of bass guitar, one being a clean sound and one overdriven. In my experience, it is favorable to make sure that the bulk of the low end and high end attack are on the clean channel and the midrange frequencies reside on the overdriven channel. This will allow you to blend in how much "cut" your bass will have in the overall mix while still retaining clean note definition and attack in the higher frequency ranges.
Gnarly bass tone - Cliffsnotes version:
1: Clean bass channel - Low/high pass gently to taste, cut slightly in the midrange (gets rid of some honky/weird sounding DI mids that make your tone sound nasty)
2: Overdriven bass channel - Cut the bulk of the low/high frequencies so that the midrange is pronounced. Add your favorite flavor of overdrive (plugin, DI, or another pedal if you have it) This channel should sound awful by itself, but blended with the clean channel will add in some gritty mids.
3: Blend the two channels until you like the tone or until it sits in the mix you're working with.
4: BONUS ROUND - If you want to get a more "live" sound feel to the recording, you can experiment with Impulse Response (IR) files. Basically, what this will do is simulate the effect of your tone playing through a live micced cab. There are some free Ampeg 8x10 IR files floating around in internet land, as well as IR loaders (you'll need this to actually use the impulses in your DAW)
And finally, to conclude I'm including a link to a file I just created to give you a rough idea of the tone I get using this method (with the Ampeg 8x10 IR's) http://soundcloud.com/ryan-bloom/reg...ss-tone-test-2
Hope that helps!