# bat file to delete characters in a file



## tumby1974 (Dec 10, 2009)

Hi all, 

I have a text file that has one line:

```
<td>50001~BUILD~09~TEST ONLY~Precision Dr, 3445 </td>
```
I'm looking to create a batch file to remove the *<td>* at the front of the line, and also remove * </td>* at the end.

I've only been able to find stuff about search and replace, and I'm having a hard time understanding the code in these bigger batch files.

Any help would be appreciated. Thanks!


Ok, I think I got it. I used a bat file I found on a different forum that dealt with character deletion.

Then on another site I found out about left, right, mid and how to manipulate characters

so:


```
@echo off > newfile & setLocal enableDELAYedexpansion

for /f "tokens=* delims= " %%a in (boolah.dat) do (
set str=%%a
set str=!str:~4,-12!
>> newfile echo !str!
)
```
This removes the first 4 characters ( <td> )
It also removes the last 12 characters (  </td> )


----------



## Squashman (Apr 14, 2005)

if the file was just one line you could have done this.

set /a str=<boolah.dat


----------

