Reading .gz without uncompressing it

Highlighted
Six Stars

Reading .gz without uncompressing it

Hi All,

 

I need to read txt.gz file and but I dont want to extract it because I need only first row (header) and count of lines in the file.

 

Any help will be appreciated.

Forteen Stars

Re: Reading .gz without uncompressing it

Hi @GopiSharma 

 

but how you are thinking to count the number of rows without unarchiving the file? even if it will be in memory, it is. still will be unarchiving

-----------
Eleven Stars

Re: Reading .gz without uncompressing it

if you are on Liunx machine , check if you have zgrep/gunzip command.

 

if yes , you could use tSystem and Zgrep/gunzip .

Regards
Abhishek KUMAR
Forteen Stars

Re: Reading .gz without uncompressing it


@akumar2301 wrote:

if you are on Liunx machine , check if you have zipgrep command.

 

if yes , you could use tSystem and Zipgrep .


for grep (pattern search) - yes

 

but for row counts?

 

in any case - 

zipgrep is a shell script and requires egrep(1) and unzip(1L) to function

it's not a "magic button" it uncompress the file and do the proper job :-)

-----------
Six Stars

Re: Reading .gz without uncompressing it

Hi Vapukov

 

Thanks for responding. Actually I was thinking if we have some existing component in Talend that can do the similar stuff like in Unix.

 

zcat file.txt.gz | wc -l

 

 

Six Stars

Re: Reading .gz without uncompressing it

Thanks for responding Abhishek, but I am using Windows. Do you any window command that will do the same thing.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog