2

I'm working with Wikipedia XML dumps and am looking for a way to extract them directly onto my ramdisk. They are simply a single xml file compressed with bzip2.

I tried

bzip2 -dk archive.bz2 /target/directory

But this ends up extracting the contents into the same directory archive.bz2 resides in. I didn't bother to wait and see if the contents get moved afterwards, as that's not what I'm looking for. Any ideas?

1

1 Answer 1

0

The samplest way I know is to do this:

cd /target/directory; bzip2 -d /path/to/achive/archive.bz2 

or you can use something like:

bzip2 -dc /path/to/achive/archive.bz2 >/target/directory/archive
7
  • On my system, this seems to create a temporary file in the archive's directory, which I would like to avoid if possible.
    – Adrian
    Feb 1, 2015 at 15:13
  • @Adrian, set TEMP variable to somewhere, for example target directory and try again. And consider bzip2 use good amount of memory when compression is high Feb 1, 2015 at 15:15
  • I tried setting TEMP=/mnt/ramdisk which is my target and then running your command from there, but I still get a temporary inside the source directory. What am I missing?
    – Adrian
    Feb 1, 2015 at 15:22
  • @Adrian, this file is actually the uncompressed archive and you can't avoid it. I personally have no info how you can set to be created somewhere else. But you can always move the archive itself Feb 1, 2015 at 15:26
  • 1
    @diralik, please check my edited answer Dec 1, 2020 at 13:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .