title: How to use regex match end of line in Windows
body: <p>I have a .txt file created in Windows and now should be edited in Linux. I want to match the end of a line with grep. Let's say the content of the line I am going to find is &quot;foo bar&quot; in file <code>bar</code>. Then I issue the command <code>grep 'r$' bar</code>, but no output yielded.</p>
  <p>Given in Windows a new line consists of '\r\n', different from Linux/Unix a single '\n', I think there must be something subtle related to this. Then I convert the file with <a href="https://en.wikipedia.org/wiki/Unix2dos" rel="nofollow noreferrer">dos2unix</a> and voila, it works.</p>
  <p>How can I match the content without convert the original file?</p>