Prev: Eight tasks, eight CPUs ... this shouldn't be hard
Next: konqueror: jumps to google, when trying to sign in to website
From: Bit Twister on 24 Apr 2010 09:30 On Sat, 24 Apr 2010 12:59:27 +0000 (UTC), Frank Stutzman wrote: > Bit Twister <BitTwister(a)mouse-potato.com> wrote: > >> >> Just using grep with above data in data_file :-D >> >> $ grep :CS201: data_file | grep -c :20101: >> 2 > > Or maybe slightly better : > egrep -c ":CS201:.*:20101:" data_file With the newer release of grep it would be grep -Ec ":CS201:.*:20101:" data_file > Might not be perfect, especially if you allow colons to be embeded within > your fields. True, but the original post shows colons as the data separators. :)
From: Frank Stutzman on 24 Apr 2010 12:20
Bit Twister <BitTwister(a)mouse-potato.com> wrote: > > True, but the original post shows colons as the data separators. :) > Yup, but I'd hazard a guess that the data schema given is not absolutely complete. Additionally, I suspect grep may not handle unicode characters correctly, but I'm not about to try to figure that solution out. -- Frank Stutzman |