Now, sometimes you already have less open, and you can't use cat on it. For example, you did a | less, and you can't just reopen a file, as that's actually a stream.
If all you need is to identify end of line, one easy way is to search for the last character on the line: /.$. The search will highlight the last character, even if it is a blank, making it easy to identify it.
That will only help with the end of line case. If you need other special characters, you can use the cat -vet solution above with marks and pipe:
- mark the top of the text you're interested in:
ma
- go to the bottom of the text you're interested in and mark it, as well:
mb
- go back to the mark a:
'a
- pipe from a to b through
cat -vet and view the result in another less command: |bcat -vet | less
This will open another less process, which shows the result of running cat -vet on the text that lies between marks a and b.
If you want the whole thing, instead, do g|$cat -vet | less, to go to the first line and filter all lines through cat.
The advantage of this method over less options is that it does not mess with the output you see on the screen.
One would think that eight years after this question was originally posted, less would have that feature... But I can't even see a feature request for it on https://github.com/gwsw/less/issues