[OS X TeX] Can we count the number of words of the selection?

Ross Moore ross at ics.mq.edu.au
Tue Nov 15 01:00:25 CET 2005


Hi all,

On 15/11/2005, at 3:26 AM, h.smith at neu.edu wrote:

> Hi all,
>
> One simple approach is to copy the selection, open a terminal and  
> run the
> command
>         pbpaste|wc
> as in
>         hs$ pbpaste|wc
>                 0      67     373


Another (longer) way using the terminal is as follows:

After copying the selection, go to a terminal window and type:

    cat | wc <return>
    <ctrl>-V            (i.e., Paste the contents of the selection)
    <return>        (needed, unless the selection finishes with a  
line-end)
    <ctrl>-D          (terminates the  cat  command)

This gives output such as:

rossmoor% cat | wc
One simple approach is to copy the selection, open a terminal and run  
the
command
        2      15      83

Those last three numbers are:  lines=2  words=15  characters=83.


A minor advantage this has over using   pbpaste | wc  is that you
get to see the selection, so can verify that it indeed refers to
the string that you wanted.

No doubt any WordService utility is doing essentially the same thing,
behind the scenes.

Another advantage is that this works with any (non-Mac) Unix system,
whereas  pbpaste  is system-dependent.


>
> The Unix "wc" command provides this function easily - perhaps not as
> "nice" as one built-in for TeXShop but...
>
> HTH
>
> Henry


Cheers,

	Ross

------------------------------------------------------------------------
Ross Moore                                         ross at maths.mq.edu.au
Mathematics Department                             office: E7A-419
Macquarie University                               tel: +61 +2 9850 8955
Sydney, Australia  2109                            fax: +61 +2 9850 8114
------------------------------------------------------------------------


------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/




More information about the macostex-archives mailing list