1.

Solve : delete first character of all lines in a text file.?

Answer»

Here is a sample of the text file:

~ === SALES Order Confirmation Message ===
~     Customer: 0023410
~     **** Delivery Date Exception. Promised Date greater than Required Date. ****
~     Required Date: Thu 10-Nov-11                Promised Date: Fri 11-Nov-11
~     NEW Sales Order: 1343943 | OW Order: 1436

I would like to delete the first character of every line.
I've tried doing find and replace, but can't seem to get it to work.
Any help would be appreciated. Code: [SELECT]echo off

setlocal enabledelayedexpansion

for /F "tokens=*" %%A in (myfile.txt) do (
set line=%%A
echo !line:~1! >> newfile.txt
)

Replace myfile.txt and newfile.txt with your own.Add in this at the end (outside the parenthesis) to make it transparent:

Code: [Select]del myfile.txt
ren newfile.txt myfile.txt



Discussion

No Comment Found