Search code examples
bashshellunixcompressionlzo

Decompressing a .lzo file using shell script


Ok so i did a fair bit of search on the web and did not find any answers. I am writing a shell script wherein I need to decompress a .lzo file. Do not see any leads. Anyone has any idea? I am basically reading a timestamped log file. My scripts accepts the year, month, date as arguments. I am able to locate my file but now when I have to decompress it, I have no clue how to handle a .lzo file. Help needed.

Thanks in advance.


Solution

  • Literally what I did to figure this out:

    $ apropos lzo
    IO::Uncompress::AnyUncompress (3perl) - Uncompress gzip, zip, bzip2 or lzop file/buffer
    

    Alright, so it's probably got something to do with lzop

    $ lzo
    No command 'lzo' found, did you mean:
     Command 'lz' from package 'mtools' (main)
     Command 'lzop' from package 'lzop' (universe)
    lzo: command not found
    

    The last one looks like it.

    $ sudo apt-get install lzop
    $ lzop 
    [...]
    Commands:
      -1     compress faster                   -9    compress better
      -d     decompress                        -x    extract (same as -dPp)
    

    Aaand chocolate for everyone!