title: Split CSV file by column number using Powershell
body: <p>I have a CSV file with around 2500 columns, without headers that split by pipeline | delimiter.</p>
  
  <p>file.csv looks like this:</p>
  
  <pre><code>x,y,z,x1,x2,x3,x4,x5,x6,x7,x8,x9,...(about 2500 more)...,x2500
  0,0,0,a1,a2,a3,a4,a5,a6,a7,a8,a9,...(about 2500 more)...,s2500
  1,1,1,b1,b2,b3,b4,b5,b6,b7,b8,b9,...(about 2500 more)...,b2500
  ….
  </code></pre>
  
  <p>I want to split the this file into multiple files based on their column number. 
  Using Bash I have used <code>cut -d "|" -f1,2-901</code> and selected the columns I wanted to save in the new file.</p>
  
  <p>Output:</p>
  
  <p>file1.csv</p>
  
  <pre><code>Key1,x2,x3,x4,x5,x6,x7,x8,x9,...(about 900 more)...,x900  
  Key2,a2,a3,a4,a5,a6,a7,a8,a9,...(about 900 more)...,a900  
  Key3,b2,b3,b4,b5,b6,b7,b8,b9,...(about 900 more)...,b900 &lt;BL&gt;
  … 
  </code></pre>
  
  <p>file2.csv</p>
  
  <pre><code>Key1,x901,x902,x903,x904,...(about 900 more)...,x1800  
  Key2,a901,a902,a904,a904,...(about 900 more)...,a1800  
  Key3,b901,b902,b903,b904,...(about 900 more)...,b1800  
  …
  </code></pre>
  
  <p>How do I do it in Powershell?</p>
  
  <p>Any help would be greatly appreciated.</p>