Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • This will not report on the last line if it doesn't have a trailing '\n' Commented Aug 15, 2011 at 22:24
  • 1
    @fred, yes, which is on purpose, because a line without a trailing \n is no real line. This is the same behavior as with my other sed/awk (tr/awk) answer. Commented Aug 16, 2011 at 7:25
  • Does this C program handle multibyte characters? Does á(U+E1 "LATIN SMALL LETTER A WITH ACUTE") and a + ` ́ `(U+61 "LATIN SMALL LETTER A" + U+301 "COMBINING ACUTE ACCENT") get counted in an equivalent manner? Commented Oct 17, 2023 at 19:16
  • 1
    @jubilatious1 no, it just works for ASCII subset. Commented Oct 18, 2023 at 12:52