Re: editor in linux shell that does charactor count?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On September 25, 2017, Linux for blind general discussion wrote:
> I can use wordperfect for word count.  still I am writing something
> that requires  a character limit.

Tim here.  Any editor that lets you write your document contents
through an external pipe should suffice.  Ed, vi/vim, and emacs all
do (I'm not sure about Nano).

In ed, you'd use

  ,w !wc

which will give you the character, word, and line counts for the
range (in this case, the whole document) that you piped into it.

For vi/vim, you can do similarly:

  :%w !wc

or in vim you can use "g control+g" to get the cursor location in the
document of the form "Col 9 of 58; Line 16 of 32; Word 146 of 291;
Byte 821 of 1625".

I don't use emacs, so I can't help much there.

Within Nano, you can use meta+D (possibly <esc> followed by "d") to
return the file stats.

If you just want one of the stats from "wc", you can use either the
"-c" (characters) "-w" (words) or "-l" (lines) parameter such as:

  :%w !wc -c

to get the character-count.

Alternatively, assuming you're just editing plain-text instead of
markup, you can save your file and just pipe it through wc:

  $ wc -c < mydocument.txt

Hope this helps,

-tim




_______________________________________________
Blinux-list mailing list
Blinux-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/blinux-list



[Index of Archives]     [Linux Speakup]     [Fedora]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]