You're viewing a comment by Sam Lachterman and its responses.

Sam Lachterman Permalink
May 08, 2011, 18:18

Regarding the CRLF example, I am confused about the pattern \r$ matching. If the text reads CR LF, then would not the LF between the CR and the end of the line prevent this pattern from matching?

Comment Responses

May 09, 2011, 06:33

It reads in the line without the trailing LF. I was just preparing my Awk One-Liners e-book and noticed that I had explained it incorrectly before. When a line gets read in $0, LF gets stripped, so if it ended with CRLF, then now it ends with CR and \r$ matches that CR.

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "cdrom_104": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.