bug-bash
[Top][All Lists]
Advanced

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

Re: count


From: Greg Wooledge
Subject: Re: count
Date: Mon, 21 Dec 2015 12:00:13 -0500
User-agent: Mutt/1.4.2.3i

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.



reply via email to

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