Skip to main content
edited title
Link

Explicitly Display newlineNewlines with grep

Source Link

Explicitly Display newline with grep

Is there a way to get grep to display the newlines in a file in a human-readable way, for example, in the way vim displays end-of-line characters as $ with :set list?

I'm trying to describe how dot (.) works in a regular expression. As an initial illustration, I search for a pattern of only dot, e.g., grep --color=auto '.' HBB.fna (image). With the --color option, every character in the file is displayed in the match color in the output. However, I would like to explicitly display the end-of-line characters to show they are not matched. Because I am talking about grep, I don't want to use anything other than it.

Example output is in the attached. Again, what I'm going for is for end-of-line characters to appear at the end of every line, not in the match color.

Any help would be appreciated.

enter image description here