- To: slug@xxxxxxxxxxx
- Subject: Re: [SLUG] Tuesday afternoon shell command optimisation party!
- From: Jamie Wilkinson <jaq@xxxxxxxxxxxxxx>
- Date: Tue, 18 Dec 2007 23:57:39 +1100
- User-agent: Mutt/1.5.17 (2007-11-01)
This one time, at band camp, Jeff Waugh wrote:
><quote who="Robert Thorsby">
>
>> > sed 's#[^,]*##g' input.txt | tr -d '\n' | wc -m
>>
>> Something like the following might be close:
>>
>> awk 'BEGIN{FS=","}{$0~",$":i=i+NF?i=i+NF-1}END{print(i)}' input.txt
>
>Close in what sense, the syntax error, the length, or the output? ;-)
Why *are* you using the g option to sed's search and replace?
Oh I see, I misread your caret. Nevermind.