Find the answer to your Linux question:
Results 1 to 4 of 4
Hi , i want to grep the data from zipped file and redirect the same data to another Zip file . ex: i want search some data from 1.gz and ...
  1. #1
    Just Joined!
    Join Date
    Sep 2009
    Posts
    6

    Grep from zip file and write to zip file

    Hi ,
    i want to grep the data from zipped file and redirect the same data to another Zip file .

    ex: i want search some data from 1.gz and want to create a file 2.gz with matched data.

    it is not recommended to write out to a unzip format file and then zip the file , as searched data will be in the size of 20Gb.

    thanks in advance

  2. #2
    Linux Guru Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    2,098
    Code:
    zgrep "foobar" 1.gz | gzip > 2.gz
    You must always face the curtain with a bow.

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Quote Originally Posted by Irithori View Post
    Code:
    zgrep "foobar" 1.gz | gzip > 2.gz
    Irithori, shouldn't that be:
    Code:
    zgrep "foobar" 1.gz | gzip -c > 2.gz
    ?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  4. #4
    Linux Guru Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    2,098
    yes it should.
    Thanks for the HeadsUp
    You must always face the curtain with a bow.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...