|
From: | John McKown |
Subject: | Re: count |
Date: | Mon, 21 Dec 2015 11:39:00 -0600 |
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.
[Prev in Thread] | Current Thread | [Next in Thread] |