Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #12065

Re: count

From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups gnu.bash.bug
Subject Re: count
Date 2015-12-21 09:31 -0500
Message-ID <mailman.306.1450708267.843.bug-bash@gnu.org> (permalink)
References <1450487143595-16675.post@n7.nabble.com> <CAAJSdjhf=DC2cZVcecs5L_c2CwMQXFQBG_Gopqnbg+esJ9BTTQ@mail.gmail.com>

Show all headers | View raw


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.

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: count Greg Wooledge <wooledg@eeg.ccf.org> - 2015-12-21 09:31 -0500

csiph-web