Solved Batch Processing- Convert Row To Column In Text Files

October 21, 2013 at 05:21:04
Specs: Windows 7
I have multiple text files . I need to convert row To column
For e.g this file which looks like following
A
B
C
D
E
Needs to be converted into:
A B C D E

Please help.


See More: Batch Processing- Convert Row To Column In Text Files

Report •

#1
October 21, 2013 at 18:42:11
I doubt if your problem is as simple as you've presented, so I won't elaborate until some sample data is posted. For your example:
@echo off & setlocal enabledelayedexpansion
for /f "tokens=*" %%a in (file.txt) do (set b=!b!%%a )
echo %b%

Report •

#2
October 21, 2013 at 19:11:48
I have multiple text file like this.

How to convert all files from row to column?


Report •

#3
October 21, 2013 at 20:38:22
✔ Best Answer
Ah, Ok, here we go... Lol!
::===== begin batch
@echo off & setlocal enabledelayedexpansion
for /f "tokens=*" %%a in ('dir /b /a-d *.z') do (
set b=
for /f "tokens=*" %%b in (%%a) do (set b=!b!%%b )
echo !b!
)>%%~na.y
::======= end

I hope it's self-explanatory: substitute desired extensions for ".z" and ".y"


Report •
Related Solutions


Ask Question