On Thu, Dec 20, 2007 at 09:18:06PM +1100, Jamie Wilkinson wrote:
> This one time, at band camp, Alex Samad wrote:
> >On Tue, Dec 18, 2007 at 11:57:39PM +1100, Jamie Wilkinson wrote:
> >> 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?
> >g - global (?) means to do it more than one time on the line
> 
> Right, yes, but I didn't see why he wanted to do a global search and replace
> on non commas originally, I read that character class incorrectly the first
> time :)

start with line 

abcde,bedgf,kasdas,ccc,

remove all non ,

,,,,

then you can wc -c ( or wc -m) for count number of bytes ( or chars)

> -- 
> SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
> Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
> 

Attachment: signature.asc
Description: Digital signature

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to