title: awk to print incremental count of occurrences of unique values in each column
body: <p>Would like print to incrementally count and then print the counts of the unique values in column 1 &amp; column 2 &amp; column 3 ...Column NF and Column $0
  and if the word is appeared only one time of column 1, would like to print remarks as "No" as duplicated flag
  and if the word is appeared more than one time of column 1, would like to print remarks as "Yes" as duplicated flag</p>
  
  <p>Looking something like this</p>
  
  <pre><code>awk -F"," '{OFS=","; if (word == $1) { counter++ } else { counter = 1; word = $1 }; print $0 ",", "Yes/No", counter }'
  </code></pre>
  
  <p>For example, I am trying to check is there any duplicate information in the field $1 (Fruits Name) . 
  Under Name field, "Apple" appears three times , "Orange" appears two times,"Mango" appear one time. 
  So if any word is not repeated more than one time is consieder as "Name_Dup=No" duplicate and count of appears is "Name_Counter=1" (i.e Mango)</p>
  
  <p>where "Apple" appears 3 times , so it is repeated/duplicated -remarks as "Yes" when it appears first time count is "Name_Dup=Yes" and Name_Counter=1" , 
  when it appears second time "Name_Dup=Yes" and Name_Counter=2,  when it appears 3rd time "Name_Dup=Yes" and Name_Counter=3</p>
  
  <p>Then need to check  each column $2, $3 .. till $NF and $0 ..</p>
  
  <p>My actual input file is not sorted on any order. No of fields used to be vary like 10 fields, 12 fields and 15 fields etc </p>
  
  <p>Input.csv</p>
  
  <pre><code>Name,Amount,Dept
  Apple,10,eee
  Orange,20,csc
  Apple,30,mec
  Mango,40,sss
  Apple,10,eee
  Orange,10,csc
  </code></pre>
  
  <p>Desired Output</p>
  
  <pre><code>Name,Amount,Dept,Name_Dup,Name_Counter,Amount_Dup,Amount_Counter,Dept_Dup,Dept_Counter,EntireLine_Dup,EntireLine_Counter
  Apple,10,eee,Yes,1,Yes,1,Yes,1,Yes,1
  Orange,20,csc,Yes,1,No,1,Yes,1,No,1
  Apple,30,mec,Yes,2,No,1,No,1,No,1
  Mango,40,sss,No,1,No,1,No,1,No,1
  Apple,10,eee,Yes,3,Yes,2,Yes,2,Yes,2
  Orange,10,csc,Yes,2,Yes,3,Yes,2,No,1
  </code></pre>
  
  <p>For example , Please find below steps for reference.</p>
  
  <p><strong>Step#1 - Field $1 check and Output</strong></p>
  
  <pre><code>Name,Name_Dup,Name_Counter
  Apple,Yes,1
  Orange,Yes,1
  Apple,Yes,2
  Mango,No,1
  Apple,Yes,3
  Orange,Yes,2
  </code></pre>
  
  <p><strong>Step#2 - Field $2 check and Output</strong></p>
  
  <pre><code>Amount,Amount_Dup,Amount_Counter
  10,Yes,1
  20,No,1
  30,No,1
  40,No,1
  10,Yes,2
  10,Yes,3
  </code></pre>
  
  <p><strong>Step#3 - Field $3 check and Output</strong></p>
  
  <pre><code>Dept,Dept_Dup,Dept_Counter
  eee,Yes,1
  csc,Yes,1
  mec,No,1
  sss,No,1
  eee,Yes,2
  csc,Yes,2
  </code></pre>
  
  <p><strong>Step#4-Field $0 check, combination of $1 &amp; $2 &amp; $3 and Output</strong></p>
  
  <pre><code>"Name,Amount,Dept",EntireLine_Dup,EntireLine_Counter
  "Apple,10,eee",Yes,1
  "Orange,20,csc",No,1
  "Apple,30,mec",No,1
  "Mango,40,sss",No,1
  "Apple,10,eee",Yes,2
  "Orange,10,csc",No,1
  </code></pre>