Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] Tuesday afternoon shell command optimisation party!


$quoted_author = "Jeff Waugh" ;
> 
> Here's a starting point. What's a more optimal way to perform this task? :-)

the first question was "what is the task trying to achieve?" :)

 
>   sed 's#[^,]*##g' input.txt | tr -d '\n' | wc -m

you appear to be counting the number of fields in a csv file but unless
there is a trailing comma each line worth of data will be 'off by 1'

cheers
marty

-- 
My Everest is not in Nepal, 
She's sleeping in the bedroom second right down the hall.
Ed Hillary couldn't crack this nut, 
He'd be hiding in the lounge room with the rest of us.

"My Everest" - Lazy Susan