[zcat] [gunzip -c] header

Hello,

When i lauches this command

ssh -n server_name gunzip -c "/REP/xxxx.gz" > server.log

There are a few stray characters like NULNULNULNUL100644 NUL000000NUL000000NUL00024002704 12135060747 012607NUL at the beginning of server.log.
In the xxxx.gz there is a tar file
I'm not sure but it seems this is the TAR's header.
Can you help me to remedy that ?

Thank you

We need to know the name of the file inside it. This should list the filenames it contains.

ssh -n server_name tar -ztf "/REP/xxxx.gz"

Hello,
Sorry for my late reply, I just returned from vacation.

Inside there is one or several tar's files.

gunzip xxxx.gz
ll
xxxx.tar

Thank you

---------- Post updated at 10:39 AM ---------- Previous update was at 03:28 AM ----------

To be clearer, take any file
For example server.log
Then pass the following commands

tar -czvf new_file.tar.gz server.log

gunzip -c new_file.tar.gz >my_file

head my_file

Now you can see few stray characters at the header

My question is how to redirect a file without header ?
Thank you in advance for your help.
.

You have a tar file there. There is a header because it is not a log file, it is a tar file.

If you want to extract the file from the tar, use tar to extract it. You have to give tar the file name.

tar -zxf "/REP/xxxx.gz" server.log

That should extract server.log from it.

Hello,

I have to deal with several archives in different servers, it is quite restrictive.
It forces me to decompress and compress the file again because it is an archive directory. Is there a simpler solution with gunzip or remove the header with grep or something ?

Thanks you.

To extract a tar file, one is supposed to use tar...

This does not force you to do so locally. You could retrieve the file first, or even stream it into tar.

ssh username@host cat /path/to/file | tar -zxf - filename