Re: find stmt with -exec wc -l '{}' \;



On Wednesday 14 May 2008 00:13, David wrote:

Hi all,

So I have a daily files received report that is automated via cron.

It is a find statement that looks like this:

find $DATAINC -type f -mtime -1 -maxdepth 1 -printf "%-52f %15s %33Ac
\n" -exec wc -l '{}' \;| grep -v '^\.' > files_received_rpt_$DATE.txt

This would work except that some files are zipped.

What are some better ways to, alongside filename and size and date,
gather a record length for each file?

Currently, I added -exec wc -l '{}' \;
to the statement, but like I said this data becomes skewed when
certain files are zipped.

Is there a specific unzip cmd that I can use to bypass the zipped
architecture without actually unzipping the file?

Any help here is greatly appreciated! Thanks!

If the files are compressed with bzip2, you can use bzcat. If they are
compressed with gzip or zip (and each zip file contains only a single
archive member), then you can use zcat.

--
D.
.



Relevant Pages

  • Re: find stmt with -exec wc -l {} ;
    ... So I have a daily files received report that is automated via cron. ... architecture without actually unzipping the file? ...
    (comp.unix.shell)
  • find stmt with -exec wc -l {} ;
    ... So I have a daily files received report that is automated via cron. ... architecture without actually unzipping the file? ...
    (comp.unix.shell)
  • Re: [SLE] cron email
    ... On 10 May, David Rankin wrote: ... Just start fetchmail in daemon mode and it will ... >> Is there anyway to suppress cron emails on successful ... Running fetchmail in daemon mode is all well and good, ...
    (SuSE)
  • Re: [SLE] cron email
    ... > On 10 May, David Rankin wrote: ... Just start fetchmail in daemon mode and it ... cron is the way to go to my mind. ...
    (SuSE)