mxmlnkn / rapidgzip

Gzip Decompression and Random Access for Modern Multi-Core Machines
Apache License 2.0
345 stars 7 forks source link

count-lines line end missing in the output #38

Closed darked89 closed 2 months ago

darked89 commented 2 months ago

Output of:

 rapidgzip --count-lines -P 0 --import-index foobar.gz.idx foobar.gz

does not have the end of line character.

Environment

mxmlnkn commented 2 months ago

I'm not entirely sure why I did it like this. I guess it shouldn't hurt to add the newline, but I might include this only in the next non-bugfix version. I'm assuming it is "only" a visual bug when using it in the terminal and therefore not urgent. Programmatic usages such as count=$( rapidgzip --count-lines foobar.gz ); echo $count work as one would expect.

darked89 commented 2 months ago

Thank you. The bash command works OK.

Not a "must have" but having rapidgzip able to count lines per file in a glob pattern and outputting number_of_lines file_name can simplify some task. What I mean:

rapidgzip --count-lines foobar_?.gz

# output:
12345     foobar_1.gz
54321     foobar_2.gz
98765     foobar_3.gz

That would be not a bug but an enhancement obviously.

mxmlnkn commented 2 months ago

Fixed with 0.13.3.

As for the suggestions with multiple arguments. I think it adds too much complexity with command line parsing without much benefit, especially as --count-lines would be the only action command allowing multiple files to be specified. A simple bash for-loop can be used instead. If there is more demand, I may give this another thought.