title: Calling a function from awk with variable input location
body: <p>I have a bunch of different files.We have used "|" as delimeter All files contain a column titled CARDNO, but not necessarily in the same location in all of the files. I have a function called data_mask. I want to apply to CARDNO in all of the files to change them into NEWCARDNO.</p>
  
  <p>I know that if I pass in the column number of CARDNO I can do this pretty simply, say it's the 3rd column in a 5 column file with something like:</p>
  
  <pre><code>awk -v column=$COLNUMBER '{print $1, $2, FUNCTION($column), $4, $5}' FILE
  </code></pre>
  
  <p>However, if all of my files have hundreds of columns and it's somewhere arbitrary in each file, this is incredibly tedious. I am looking for a way to do something along the lines of this:</p>
  
  <pre><code>awk -v column=$COLNUMBER '{print #All columns before $column, FUNCTION($column), #All columns after $column}' FILE
  </code></pre>
  
  <p>My function takes a string as an input and changes it into a new one. It takes the value of the column as an input, not the column number. Please suggest me Unix command which can pass the column value to the function and give the desired output.
  Thanks in advance</p>