how to properly use of sed in linux : <p>I have a folder in present working dir with a file</p>

<pre><code>./folder/sample
</code></pre>

<p>The contents of the file were having some export commands and # lines, how do i get the output removing all those lines, i don't know how to use Sed here its pretty confusing.</p>

<p>content inside the sample file is like this</p>

<pre><code>#helloworld

export a=foo
export b=hello

#helloworld2

export c=king
export d=queen
</code></pre>

<p>the expected output should remove #(commented lines), export words and empty lines, the output should be like this. </p>

<pre><code>a=foo
b=hello
c=king
d=queen
</code></pre>

<p>and also it should rename the file in the same folder on the fly.</p>

<pre><code>./folder/rename-sample
</code></pre>

<p>Please let me know how to achieve this using proper SED command.</p>
