I have a multiple line file (about 300 - 400 lines) each line has 72 characters and i need that transformed into a single line.
Any ideas ?
I have a multiple line file (about 300 - 400 lines) each line has 72 characters and i need that transformed into a single line.
Any ideas ?
This is possible, assuming you want your concatenated line in one line in a text file. However, even though you can create the long line with batch, you will not be able to read the line using batch. As Electro Hacker says, you cannot create a batch environment variable longer than 8191 bytes long.
XP SET /P
will preserve leading spaces from each line. But SET /P
on Vista and beyond strips leading spaces.
This solution adds a space between each concatenated line.
@echo off
setlocal
set "infile=test.txt"
set "outfile=out.txt"
>"%outfile%" (
for /f usebackq^ delims^=^ eol^= %%A in ("%infile%") do <nul set /p "=%%A "
)
If you want to stick to standard Windows tools, PowerShell would also be an option:
-join (Get-Content foo.txt)
You can't break a limitation of the OS, you can't break the 255 chars path in Windows, and you can't break the CMD interpreter lenght limitation, simply as that!
Sorry but you can't store that line into a var, no way, don't exist any magic, computers are logical.
But it's not the end of the world, you can do it so easy in any other lenguage, I recommend you Ruby or python (Ruby for that), it's an easy job, open a file, store the content into a var, and then do what you want, don't need any experience for that, if you need a example just comment this.