I have a directory with both uncompressed and gzipped files and want to run wc -l
on this directory. wc
will provide a line count value for the compressed files which is not accurate (since it seems to count newlines in the gzipped version of the file). Is there a way to create a zwc
script similar to zgrep
that will detected the gzipped files and count the uncompressed lines?
From stackoverflow
-
Try this zwc script:
#! /bin/bash -- for F in "$@"; do echo "$(zcat -f <"$F" | wc) $F" done
Reef : It should be "echo "$(zcat -f <"$F" | wc -l) $F"pseinstein : Thanks, this works great.Chas. Owens : or $(zgrep -c "" $F)
0 comments:
Post a Comment