I needed a script to remove the linefeed from the first row of a text file.
Other - similar topics I've researched were confusing, and had many irrelevant or misleading responses,
I needed a script to remove the linefeed from the first row of a text file.
Other - similar topics I've researched were confusing, and had many irrelevant or misleading responses,
the way I used to get the first row (NOTE: i have not tested if this also removes other hidden chars, but I was advised it does- like CR, so please be aware) content and also remove the linefeed(=LF character) on Windows-command prompt/batch file/CMD/command is:
for /F "delims=" %%i in (source_file.txt) do (
<nul (set/p z=%%i) >outputfile.txt
goto BREAK1
)
:BREAK1
Immidiately Under :BREAK1 row, you continue working on with a LineFeed free outputfile.txt
If you only need the first line, reading with set /p is simpler than a FOR/F loop.
setlocal EnableDelayedExpansion
set /p line= < source_file.txt
<nul set /p ".=!line!" > outputfile.txt