|
Home > Archive > Unix Programming > August 2005 > sort pipe gzip > unexpected end of file
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
sort pipe gzip > unexpected end of file
|
|
| huu_khoa_nguyen@yahoo.com.au 2005-08-14, 8:49 pm |
| Hi, I get the ``unexpected end of file'' error when I do the following:
% ls -hl
-rw-rw-r-- 1 joe joe 20M Aug 11 15:55 me1.csv.gz
-rw-rw-r-- 1 joe joe 20M Aug 11 15:55 me2.csv.gz
-rw-rw-r-- 1 joe joe 20M Aug 11 15:55 me3.csv.gz
-rw-rw-r-- 1 joe joe 20M Aug 11 15:55 me4.csv.gz
% gzip -dc me1.csv.gz | head -n 1
Joe,20040205,09:35:34
% gzip -dc me* | sed -e 's/://g' | sort -T ./data -t, -k3,3n | gzip -c
> me.csv.gz
gzip: ./data/me.csv.gz: unexpected end of file
Any idea? Thanks in advance.
| |
| Pascal Bourguignon 2005-08-14, 8:49 pm |
| huu_khoa_nguyen@yahoo.com.au writes:
> Hi, I get the ``unexpected end of file'' error when I do the following:
>
> % ls -hl
> -rw-rw-r-- 1 joe joe 20M Aug 11 15:55 me1.csv.gz
> -rw-rw-r-- 1 joe joe 20M Aug 11 15:55 me2.csv.gz
> -rw-rw-r-- 1 joe joe 20M Aug 11 15:55 me3.csv.gz
> -rw-rw-r-- 1 joe joe 20M Aug 11 15:55 me4.csv.gz
>
> % gzip -dc me1.csv.gz | head -n 1
> Joe,20040205,09:35:34
>
> % gzip -dc me* | sed -e 's/://g' | sort -T ./data -t, -k3,3n | gzip -c
> gzip: ./data/me.csv.gz: unexpected end of file
>
> Any idea? Thanks in advance.
Think about it! Who creates or opens what file and when?
gzip -dc me*|sed -e 's/://g'|sort -T ./data -t, -k3,3n|gzip -c>me.csv.gz
--
__Pascal Bourguignon__ http://www.informatimago.com/
Nobody can fix the economy. Nobody can be trusted with their finger
on the button. Nobody's perfect. VOTE FOR NOBODY.
| |
| Bill Marcum 2005-08-15, 2:48 am |
| On 14 Aug 2005 17:31:32 -0700, huu_khoa_nguyen@yahoo.com.au
<huu_khoa_nguyen@yahoo.com.au> wrote:
> Hi, I get the ``unexpected end of file'' error when I do the following:
>
> % ls -hl
> -rw-rw-r-- 1 joe joe 20M Aug 11 15:55 me1.csv.gz
> -rw-rw-r-- 1 joe joe 20M Aug 11 15:55 me2.csv.gz
> -rw-rw-r-- 1 joe joe 20M Aug 11 15:55 me3.csv.gz
> -rw-rw-r-- 1 joe joe 20M Aug 11 15:55 me4.csv.gz
>
> % gzip -dc me1.csv.gz | head -n 1
> Joe,20040205,09:35:34
>
> % gzip -dc me* | sed -e 's/://g' | sort -T ./data -t, -k3,3n | gzip -c
> gzip: ./data/me.csv.gz: unexpected end of file
>
> Any idea? Thanks in advance.
>
The redirection "> me.csv.gz" creates an empty file, which matches the
wildcard "me*", so gzip tries to uncompress the empty file.
--
BOFH excuse #426:
internet is needed to catch the etherbunny
|
|
|
|
|