bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: count


From: John McKown
Subject: Re: count
Date: Mon, 21 Dec 2015 11:39:00 -0600

I've "squirreled" that one away on GitHub, in a gist. Thanks.

On Mon, Dec 21, 2015 at 11:00 AM, Greg Wooledge <wooledg@eeg.ccf.org> wrote:
On Mon, Dec 21, 2015 at 08:53:55AM -0700, Krem wrote:
> I tried this one, but failed if the folder has more than one file name (eg
> *.csv) in that folder.

Seriously, use this one:

find . \( -iname '*.txt' -o -iname '*.csv' \) -exec bash -c '
  for f; do
    IFS=/ read -ra part <<< "$f"
    printf "%-10.10s  %-10.10s  %-20.20s  %5d\n" \
      "${part[1]}" "${part[2]}" "${part[3]}" "$(wc -l < "$f")"
  done
' _ {} +

Adjust it as needed.  This is the most straightforward approach to the
problem.




--
Computer Science is the only discipline in which we view adding a new wing to a building as being maintenance -- Jim Horning

Schrodinger's backup: The condition of any backup is unknown until a restore is attempted.

Yoda of Borg, we are. Futile, resistance is, yes. Assimilated, you will be.

He's about as useful as a wax frying pan.

10 to the 12th power microphones = 1 Megaphone

Maranatha! <><
John McKown

reply via email to

[Prev in Thread] Current Thread [Next in Thread]