bug-bash
[Top][All Lists]
Advanced

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

Re: count


From: Krem
Subject: Re: count
Date: Mon, 21 Dec 2015 10:52:30 -0700 (MST)

John,
The problem is not the number of files  but somehow the script does not go in some of the folders and stops there.


On Monday, December 21, 2015 11:39 AM, John McKown [via Gnu - Bash] <[hidden email]> wrote:


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

On Mon, Dec 21, 2015 at 11:00 AM, Greg Wooledge <[hidden email]> 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



If you reply to this email, your message will be added to the discussion below:
http://gnu-bash.2382.n7.nabble.com/count-tp16675p16701.html
To unsubscribe from count, click here.
NAML




View this message in context: Re: count
Sent from the Gnu - Bash mailing list archive at Nabble.com.

reply via email to

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