UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 30th, 2006, 12:06 PM
jennashton jennashton is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 138 jennashton User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 h 29 m 22 sec
Reputation Power: 6
Possible to Grep within .gz file without uncompress first?

When uncompressed the file size is over 800 megs, I wanted to know if I can search for a string within the compressed .gz file without uncompressing...

Reply With Quote
  #2  
Old June 30th, 2006, 12:16 PM
edman007's Avatar
edman007 edman007 is offline
Trapped on the forums...help
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Aug 2003
Location: /Users/edman007
Posts: 4,617 edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)  Folding Points: 67263 Folding Title: Intermediate FolderFolding Points: 67263 Folding Title: Intermediate FolderFolding Points: 67263 Folding Title: Intermediate FolderFolding Points: 67263 Folding Title: Intermediate Folder
Time spent in forums: 1 Month 3 Weeks 3 Days 5 h 3 m 10 sec
Reputation Power: 788
Send a message via AIM to edman007
well your going to have to decompress it in one way, but you don't have to store the uncompressed data

Code:
zcat /file.gz | grep string


that will decompress it and pipe it to grep, so it will take a lot of CPU, but its won't store anything to the hard drive
__________________
Feed ME

Reply With Quote
  #3  
Old June 30th, 2006, 12:20 PM
jennashton jennashton is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 138 jennashton User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 h 29 m 22 sec
Reputation Power: 6
Quote:
Originally Posted by edman007
well your going to have to decompress it in one way, but you don't have to store the uncompressed data

Code:
zcat /file.gz | grep string


that will decompress it and pipe it to grep, so it will take a lot of CPU, but its won't store anything to the hard drive


Thanks I'll give that a shot.

Reply With Quote
  #4  
Old June 30th, 2006, 04:04 PM
jim mcnamara jim mcnamara is offline
......@.........
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jun 2004
Posts: 1,308 jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 5 h 20 m 49 sec
Reputation Power: 48
Consider also:
Code:
zgrep 'value to find' filename.gz
Comments on this post
kicken agrees!

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Possible to Grep within .gz file without uncompress first?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT