[CentOS] question on grep
aharrison at gmail.com
Wed Oct 10 19:07:47 UTC 2007
-----BEGIN PGP SIGNED MESSAGE-----
On 10/10/07, Jerry Geis wrote:
> Is there a command line option on grep that says
> count ALL occurances on a line not just the first one???
> echo "jerry jerry" | grep -c jerry
Grep can just count the number of lines with occurrences not the
number of them. You can do it in perl though.
# echo "jerry jerry" | perl -lane '$count = grep $_ =~ m/jerry/, @F;
public key: 0x67518262
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
-----END PGP SIGNATURE-----
More information about the CentOS