title: How to grep lines that end with .c or .cpp?
body: <p>I have a file as below, I want to grep for lines having <code>.c</code> or <code>.cpp</code> extension. I have tried using <code>cat file|grep ".c"</code> grep but I am getting all types of extensions as output. Please shed some light on this. Thanks in advance.</p>
  
  <pre><code>file contents are below:
  /dir/a/b/cds/main.c
  /dir/a/f/cmdss/file.cpp
  /dir/a/b/cds/main.h
  /dir/a/f/cmdss/file.hpp
  /dir/a/b/cdys/main_abc.c
  /dir/a/f/cmfs/file_123.cpp
  </code></pre>