Computing.Net > Forums > Programming > Remove next line from a .txt file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Remove next line from a .txt file

Reply to Message Icon

Name: ollivier
Date: March 4, 2009 at 10:34:37 Pacific
OS: Windows XP
Subcategory: Batch
Comment:

does any body know how to remove
"new line" using a .bat file

initial file1.txt

dog
cat
mouse
horse

final file2.txt

dogcatmousehorse



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: March 4, 2009 at 14:25:12 Pacific
Reply:

It depends on the file's size, i.e. if your file is of limited size as you posted and anyway no more than, say, 1024 bytes or so, then

@echo off & setlocal EnableDelayedExpansion
set line=
for /F "delims=" %%j in (file1.txt) do set line=!line!%%j
echo.%line%> file2.txt
:: End_Of_Batch


0
Reply to Message Icon

Related Posts

See More


bat file display folder s... set name=%filename% help



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Remove next line from a .txt file

Read all lines from a txt file www.computing.net/answers/programming/read-all-lines-from-a-txt-file/19395.html

delete x number of lines from a CSV file www.computing.net/answers/programming/delete-x-number-of-lines-from-a-csv-file/19820.html

Delete blank lines from a text file www.computing.net/answers/programming/delete-blank-lines-from-a-text-file/14525.html