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*

5
  • You first example actually produces barandard input):... Commented Sep 21, 2017 at 22:26
  • @StephenKitt Actually, that's what I was expecting but on my terminal I get what I wrote in my answer. Commented Sep 21, 2017 at 22:36
  • I stand corrected, if your grep outputs colour you will indeed only get bar. I had tried with a non-colourised grep (which does result in barandard input):). (The curious can run printf 'foo\rbar\n' | grep -Ho --color=always '.bar' | od -xa to understand what’s going on.) Commented Sep 22, 2017 at 4:20
  • Nice catch @Stephen, I did notice that redirecting to hexdump shows that the text was here but I wasn't able to figure out why it wasn't visible. Commented Sep 22, 2017 at 9:56
  • Both of these are great ideas of what could have been happening given no knowledge of the regex or the text file. Exploring to see if either of these were the issue, I found what is causing it and edited my question. I still don't have a solution for the issue however. Commented Sep 22, 2017 at 16:39