Windows command for cutting columns from a text

Vineel Kumar Reddy picture Vineel Kumar Reddy · Dec 14, 2010 · Viewed 35.5k times · Source

The following content is stored in a file:

chrome.exe                   512 Console                 0     73,780 K
chrome.exe                   800 Console                 0     11,052 K
chrome.exe                  1488 Console                 0     92,720 K
chrome.exe                  1600 Console                 0     32,344 K
chrome.exe                  2240 Console                 0     35,132 K
chrome.exe                  2360 Console                 0     21,276 K
chrome.exe                  3524 Console                 0     66,732 K
chrome.exe                  3924 Console                 0     23,524 K

Is there a way to extract the 5th column with the Windows command line?

Something like the UNIX cut command.

Answer

Sanjit Saluja picture Sanjit Saluja · Dec 14, 2010

Use double % in variable

for /f "tokens=5 delims= " %%i in (file.txt) DO echo %%i