• About the end of line symbols displayed by `cat -ve'.

    From hongyi.zhao@gmail.com@21:1/5 to All on Sat Aug 21 06:55:45 2021
    See the following testing:

    $ cat -ve aaa
    bla^M$

    Why don't the end of line symbols displayed as `^M^J'?

    Regards,
    HY

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to hongy...@gmail.com on Sat Aug 21 16:15:17 2021
    On 21.08.2021 15:55, hongy...@gmail.com wrote:
    See the following testing:

    $ cat -ve aaa
    bla^M$

    Why don't the end of line symbols displayed as `^M^J'?

    Do you ever read the man page?

    Janis

    Regards,
    HY


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Spiros Bousbouras@21:1/5 to hongy...@gmail.com on Sat Aug 21 14:46:45 2021
    On Sat, 21 Aug 2021 06:55:45 -0700 (PDT)
    "hongy...@gmail.com" <hongyi.zhao@gmail.com> wrote:
    See the following testing:

    $ cat -ve aaa
    bla^M$

    Why don't the end of line symbols displayed as `^M^J'?

    Because this is how the designers of cat decided to do things. Why they decided to do it this way and , more generally , how $ came to be associated with the end (of lines or files or regular expression matches) is an interesting
    question but likely more topical on alt.folklore.computers or comp.misc than here.

    --
    vlaho.ninja/prog

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to hongy...@gmail.com on Sat Aug 21 15:49:54 2021
    On Sat, 21 Aug 2021 06:55:45 -0700, hongy...@gmail.com wrote:

    See the following testing:

    $ cat -ve aaa
    bla^M$

    Why don't the end of line symbols displayed as `^M^J'?

    Because unix tools expect text lines to end with the ^J
    LineFeed character, and the cat(1) -v option will
    "use ^ and M- notation, EXCEPT for LFD (linefeed) and
    TAB".
    So, you don't get to see the ^J at the end of a unix text
    line with the cat(1) -v option.

    However, the cat(1) -E option (invoked when you specified
    -e) will
    "display $ at end of each line"
    where the ^J unix text line terminator would appear.

    As to why cat(1) gives you ^M$ instead of just $, it appears
    that you fed cat(1) with an MSDOS/MSWindows plain text file,
    and MSDOS/MSWindows terminates each text line with the ASCII
    character pair of Carriage Return (^M) followed by LineFeed
    (^J). cat(1) doesn't speak MSDOS/MSWindows, and knows nothing
    of it's quirks.

    HTH
    --
    Lew Pitcher
    "In Skills, We Trust"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Aragorn@21:1/5 to All on Sat Aug 21 19:50:01 2021
    On 21.08.2021 at 16:15, Janis Papanagnou scribbled:

    On 21.08.2021 15:55, hongy...@gmail.com wrote:
    See the following testing:

    $ cat -ve aaa
    bla^M$

    Why don't the end of line symbols displayed as `^M^J'?

    Do you ever read the man page?

    Was that a rhetorical question?

    And do you remember that as per Kenny's decree, all followups to a post
    by HZ _must be_ in the form of a question?

    --
    With respect,
    = Aragorn =

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)