Computing.Net > Forums > Programming > Remove last 2 characters from each line....

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Remove last 2 characters from each line....

Reply to Message Icon

Name: Iggy82
Date: November 5, 2009 at 05:01:09 Pacific
OS: Windows XP
Subcategory: Batch
Comment:

I have a large file of text, with exactly 34 characters on each line.
I want to run a batch to remove the last 2 characters of each line so that I have 32 characters on each line.

Been trying to do this for ages without success!



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: November 5, 2009 at 05:55:50 Pacific
Reply:

@echo off & setlocal EnableDelayedExpansion > "fileOUT.txt"
for /F "delims=" %%j in ('type "FileIN.txt"') do (
  set line=%%j
  echo.!line:~0,-2!>> "fileOUT.txt
)
:: End_OF_Batch


0

Response Number 2
Name: Iggy82
Date: November 5, 2009 at 06:23:10 Pacific
Reply:

Legend, thanks very much


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


VBScript Help - Retrievin... create vars from txtfile ...


Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Remove last 2 characters from each line....

delete first three characters from each line www.computing.net/answers/programming/delete-first-three-characters-from-each-line/20245.html

Get last 4 character from a file www.computing.net/answers/programming/get-last-4-character-from-a-file/19808.html

Perl: Stripping last 4 characters from string www.computing.net/answers/programming/perl-stripping-last-4-characters-from-string/19568.html