title: Pulling certain tokens in for /f in batch file
body: <p>OK, I'm new to here and new to batch scripting, but I am starting to get the hang of it.</p>
  
  <p>This is what I am trying to do.  I have a file that contains a line that I pulled from another file and is tab separated.  The line looks like this:</p>
  
  <pre><code>COL1 COL2 COL3 COL4 COL5 COL6
  Date name ID   Cost dept site
  </code></pre>
  
  <p>What I am trying to do is pull just certain tokens out to set some text files.  But I am having issues with handling blank tokens/columns, and some of the columns have spaces in them.  This is the code that I have, but it does not return what I am looking for</p>
  
  <pre><code>SET datalocation=mydatalocation
  for /f "skip=1 tokens=1,4,6" %%a in (%datalocation%\filename.txt) do (
      echo %%a &gt; %datalocation%\col1.txt
      echo %%b &gt; %datalocation%\col4.txt
      echo %%c &gt; %datalocation%\col6.txt
      )
  </code></pre>
  
  <p>The output I am getting is a mess.  COL1.txt will have half of col1 and all of col2 in it.  Col4.txt and Col6.txt both state echo is off, so I assume the variable returned was blank.</p>
  
  <p>Any help would be appreciated. </p>
  
  <p>attaching sample data </p>
  
  <p>Last Connect    Device ID   Operating System    OS Level    Serial Num  MAC Address Primary UserID  Primary First Name  Primary Last Name   Primary Expense Code    Billed UID  Billed First Name   Billed Last Name    Billed Expense Code
  12/10/2013 8:16 Mycomputer  Microsoft Windows 7 Enterprise Version 6.1.7601 [Build 7601]    Service Pack 1  1234abc 4437e6a3e5d5    JasonM  Jason   Moseley CB0000012345    JasonM  Jason   Moseley CB0000012345</p>