Computing.Net > Forums > Programming > Batch delete first and last charact

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.

Batch delete first and last charact

Reply to Message Icon

Name: p1ng
Date: June 12, 2008 at 10:31:53 Pacific
OS: XP
CPU/Ram: 256
Product: Gateway
Comment:

I need something to delete the first and last character on the first 3 lines.
The character is a "

EX: My program creates a text file that looks like:
"This is the first line"
"this is the second line"
"this is the thrid line"
I'm just asking for something that could remove the Quotes.
Thanks



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: June 12, 2008 at 11:02:12 Pacific
Reply:

@echo off > newfile
setLocal EnableDelayedExpansion

for /f "tokens=* delims= " %%a in (myfile) do (
set /a N+=1
if !N! gtr 3 ( echo %%a >> newfile
) else (
set str=%%a
set str=!str:"=!
echo !str! >> newfile
)
)


=====================================
If at first you don't succeed, you're about average.

M2


0

Response Number 2
Name: p1ng
Date: June 12, 2008 at 14:06:20 Pacific
Reply:

Thanks Mechanix2Go!
I just had to alter my script to make a temp file so your script could make the final page needed. Worked great. I was wondering if you want me to include you in the making of the program or not.


0

Response Number 3
Name: Mechanix2Go
Date: June 12, 2008 at 17:25:35 Pacific
Reply:

Sure, why not.


=====================================
If at first you don't succeed, you're about average.

M2


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


.bat script for latest fi... Copy folders in a batch f...



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: Batch delete first and last charact

Parse first/last character in batch www.computing.net/answers/programming/parse-firstlast-character-in-batch/18536.html

sum of first and last numbers c++ www.computing.net/answers/programming/sum-of-first-and-last-numbers-c/13997.html

Net User /ADD first and last name www.computing.net/answers/programming/net-user-add-first-and-last-name/12638.html