unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to get count of a specific character
@ 2014-02-04 14:29 Angus Comber
  2014-02-04 14:44 ` Nicolas Richard
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Angus Comber @ 2014-02-04 14:29 UTC (permalink / raw)
  To: help-gnu-emacs

I have a buffer which is a massive long line of names followed by semi-colon.  I want to get a list of the number of names I have.  I can highlight the region and use wc to get count of words and divide by 2 to get a rough measure.

But it would be an easy task if I could simply get a count of the number of semi-colon characters?

Does anyone know a way to get this?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to get count of a specific character
  2014-02-04 14:29 How to get count of a specific character Angus Comber
@ 2014-02-04 14:44 ` Nicolas Richard
  2014-02-04 14:48 ` Thorsten Jolitz
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Nicolas Richard @ 2014-02-04 14:44 UTC (permalink / raw)
  To: Angus Comber; +Cc: help-gnu-emacs

Angus Comber <anguscomber@gmail.com> writes:

> I have a buffer which is a massive long line of names followed by
> semi-colon. I want to get a list of the number of names I have. I can
> highlight the region and use wc to get count of words and divide by 2
> to get a rough measure.
>
> But it would be an easy task if I could simply get a count of the number of semi-colon characters?
>
> Does anyone know a way to get this?
>

highlight region and:
M-x count-matches RET ; RET

-- 
Nico.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to get count of a specific character
  2014-02-04 14:29 How to get count of a specific character Angus Comber
  2014-02-04 14:44 ` Nicolas Richard
@ 2014-02-04 14:48 ` Thorsten Jolitz
  2014-02-04 14:49 ` Loris Bennett
       [not found] ` <mailman.13678.1391525077.10748.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 6+ messages in thread
From: Thorsten Jolitz @ 2014-02-04 14:48 UTC (permalink / raw)
  To: help-gnu-emacs

Angus Comber <anguscomber@gmail.com> writes:

> I have a buffer which is a massive long line of names followed by
> semi-colon.  I want to get a list of the number of names I have.  I
> can highlight the region and use wc to get count of words and divide
> by 2 to get a rough measure.
>
> But it would be an easy task if I could simply get a count of the
> number of semi-colon characters?
>
> Does anyone know a way to get this?

Maybe

,------------------------------
| C-x h M-x count-matches RET ;
`------------------------------

i.e. using `mark-whole-buffer' and 'count-matches'.

-- 
cheers,
Thorsten




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to get count of a specific character
  2014-02-04 14:29 How to get count of a specific character Angus Comber
  2014-02-04 14:44 ` Nicolas Richard
  2014-02-04 14:48 ` Thorsten Jolitz
@ 2014-02-04 14:49 ` Loris Bennett
       [not found] ` <mailman.13678.1391525077.10748.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 6+ messages in thread
From: Loris Bennett @ 2014-02-04 14:49 UTC (permalink / raw)
  To: help-gnu-emacs

Angus Comber <anguscomber@gmail.com> writes:

> I have a buffer which is a massive long line of names followed by
> semi-colon.  I want to get a list of the number of names I have.  I
> can highlight the region and use wc to get count of words and divide
> by 2 to get a rough measure.
>
> But it would be an easy task if I could simply get a count of the
> number of semi-colon characters?
>
> Does anyone know a way to get this?

If you do 

M-x re-builder

when you are in the buffer and then enter ";" as the regex, the number
of matches will be displayed.

Cheers,

Loris

-- 
This signature is currently under construction.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to get count of a specific character
       [not found] ` <mailman.13678.1391525077.10748.help-gnu-emacs@gnu.org>
@ 2014-02-04 15:28   ` Angus Comber
  2014-02-04 15:34     ` Nicolas Richard
  0 siblings, 1 reply; 6+ messages in thread
From: Angus Comber @ 2014-02-04 15:28 UTC (permalink / raw)
  To: help-gnu-emacs

On Tuesday, 4 February 2014 14:44:21 UTC, Nicolas Richard  wrote:
> Angus Comber <anguscomber@gmail.com> writes:
> 
> 
> 
> > I have a buffer which is a massive long line of names followed by
> 
> > semi-colon. I want to get a list of the number of names I have. I can
> 
> > highlight the region and use wc to get count of words and divide by 2
> 
> > to get a rough measure.
> 
> >
> 
> > But it would be an easy task if I could simply get a count of the number of semi-colon characters?
> 
> >
> 
> > Does anyone know a way to get this?
> 
> >
> 
> 
> 
> highlight region and:
> 
> M-x count-matches RET ; RET
> 

Brilliant, thanks.  Note you have to escape ;


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to get count of a specific character
  2014-02-04 15:28   ` Angus Comber
@ 2014-02-04 15:34     ` Nicolas Richard
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Richard @ 2014-02-04 15:34 UTC (permalink / raw)
  To: Angus Comber; +Cc: help-gnu-emacs

Angus Comber <anguscomber@gmail.com> writes:
> On Tuesday, 4 February 2014 14:44:21 UTC, Nicolas Richard  wrote:
>> M-x count-matches RET ; RET
>
> Brilliant, thanks.  Note you have to escape ;

In fact I don't have to escape ; -- I'm surprised you do.

-- 
Nico.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-02-04 15:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-04 14:29 How to get count of a specific character Angus Comber
2014-02-04 14:44 ` Nicolas Richard
2014-02-04 14:48 ` Thorsten Jolitz
2014-02-04 14:49 ` Loris Bennett
     [not found] ` <mailman.13678.1391525077.10748.help-gnu-emacs@gnu.org>
2014-02-04 15:28   ` Angus Comber
2014-02-04 15:34     ` Nicolas Richard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).