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 08:48:46 -0600

Thanks for the training. I appreciate people pointing out my errors, that's how I learn too. I'll blame GMAIL for the mish-mash. I don't have as good a control of it as I would like (sorry). I'm always forgetting about people who put LFs in a file name. That is just so weird, to me. I should remember about the damnable blanks in a file name. They are a PITA to me all the time (I hold MS responsible for this abomination taking hold).
​ The need for "./[0-9]*'​ was in a subsequent posting by Krem that the subdirectory names must begin with a digit. Especially thanks for the fix on the "find" with the need to surround the file name extension tests in parentheses. And I do have a tendency, due to ignorance, of putting in unnecessary escapes and using egrep instead of plain grep even if I'm just doing a BRE instead of an ERE.

On Mon, Dec 21, 2015 at 8:31 AM, Greg Wooledge <wooledg@eeg.ccf.org> wrote:
On Mon, Dec 21, 2015 at 08:21:04AM -0600, John McKown wrote:
> find . -maxdepth 2 -mindepth 2 -type f -name '*.csv' -o -name '*.txt' |\
> egrep '^\./[0-9]' |\
> xargs awk 'ENDFILE {print FILENAME "\t" FNR;}' |\
> sed -r 's|^./||;s|/|\t|'   |\
> xargs -L 1 echo -e "${PWD##*/}\t"???

> ???This is "more elegant" (in my mathematically twisted mind) than my
> previous solution.

No, it's not.

In addition to whatever quoting bugs may still exist, now you're involving
xargs, which has ITS OWN ENTIRELY NEW set of bugs, and breaks on any
filename that contains whitespace, single quotes, or double quotes.



--
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]