Select column from text file using windows package

I have a text file with the data below

162       y    1   0     518       home47              1     
163       y    1   0     520       home41              1     
164       y    1   0     522       home43              1     
165       y    1   0     524       home45              1     
166       y    1   0     526       home46              1     
169       y    1   0     531       home50              1     
170       y    1   0     533       home52              1     
171       y    1   0     535       home54              1     
172       y    1   0     537       home56              1     
173       y    1   0     539       home58              1 

      

I would like to copy the data of the sixth column from the bottom (home47 to home58) to another text file using a windows batch file . How can I accomplish this

I tried with below command which is mentioned in other questions but doesn't work for me

CMD /f:off
FOR /f "tokens=6 delims=  " %B in (TabFile.txt) do @echo %B  >> 2ColFile.txt  
CMD /f:on

      

+3


source to share


1 answer


@echo off
break>2ColFile.txt
for /f "tokens=6 delims=     " %%c in (TabFile.txt) do (
    echo %%c
)>>2ColFile.txt

      



EDIT Keep in mind the delimiters delims=<tab><space>

, and can be changed using stackoverflow formatting.

+1


source







All Articles