[NTLUG:Discuss] Counting key presses in a file...
Robert Citek
robert.citek at gmail.com
Mon Aug 27 15:35:55 CDT 2007
On 08/27/2007 03:13 PM, Richard Geoffrion wrote:
> I know that 'wc' can count words and lines, but how would one count.
> While 'a' would constitute ONE keystroke, 'A' would constitute two.
> (Shift + a).
Not necessarily. If you have CapsLock on, then the reverse would be
true. That is, 'A' would count as one and 'a' as two. What would happen
if it was a string of 'A's, as in AAA? I only used four keystrokes:
CapLock followed by three 'a's. What about longer strings, like
AAAAAAAAAAAAAAAAA? In that case it took me two keystrokes: shift plus
press and hold 'a'.
> Carriage returns would count as one while bolding text
> would constitute four keystrokes as one would need a CTRL-B to turn
> bolding on and another to turn bolding off.
What if I type 'a^Hah'? What if I type 'a{left arrow}h'? What if I
type 'ah'? They all produce 'ah' but are a different number of
key-strokes. Lastly, what about cut and paste?
> How would one go about taking an openoffice document saved in the
> 97/2000 'Word' format and converting it into something that can be
> parsed and counted?
If you can't use Word, which has a built-in counter, then open the
document in OpenOffice Writer, press Ctrl-A to highlight everything,
press Ctrl-C to copy all the text in the clipboard, open gedit, press
Ctrl-V to pasted the text into gedit, and save as a textfile
"foobar.txt" Then open a terminal and type 'wc foobar.txt'.
Am I even close to answering your question?
Regards,
- Robert
More information about the Discuss
mailing list