title: Using cat and grep to print line and its number but ignore at the same time blank lines
body: <p>I have created a simple script that prints the contents of a text file using cat command. Now I want to print a line along with its number, but at the same time I need to ignore blank lines. The following format is desired:</p>
  
  <pre><code>1 George Jones Berlin 2564536877
  2 Mike Dixon Paris 2794321976
  </code></pre>
  
  <p>I tried using </p>
  
  <pre><code>cat -n catalog.txt | grep -v '^$' catalog.txt
  </code></pre>
  
  <p>But I get the following results:</p>
  
  <pre><code> George Jones Berlin 2564536877
   Mike Dixon Paris 2794321976
  </code></pre>
  
  <p>I have managed to get rid of the blank lines, but line's number is not printed. What am I doing wrong?</p>
  
  <p>Here are the contents of catalog.txt:</p>
  
  <pre><code> George Jones Berlin 2564536877
  
   Mike Dixon Paris 2794321976
  </code></pre>