title: Awk command to perform action on lines excluding 1st and last
body: <p>I have multiple MS excel files in csv format in a particular directory.
  I want to update the value of one particular column in all the rows of the csv files.</p>
  
  <p>Also, the action should not be operated on 1st and last line.
  So far I have come up with below code for one row:</p>
  
  <pre><code>awk -F, 'NR&gt;2{$2=300;}1' OFS=, test.csv
  </code></pre>
  
  <p>But i am facing difficulty in excluding the last line.
  Also, i need to perform the same for all the files in the directory.</p>
  
  <p>So far tried the below but not able to succeed to replace that string value using awk.
  1)</p>
  
  <p><a href="https://i.stack.imgur.com/T9vFg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T9vFg.png" alt="enter image description here"></a></p>
  
  <p>2)</p>
  
  <p><a href="https://i.stack.imgur.com/PTvgm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PTvgm.png" alt=" a"></a></p>