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

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

Batch delete first and last charact

Reply to Message Icon

Original Message
Name: p1ng
Date: June 12, 2008 at 10:31:53 Pacific
Subject: Batch delete first and last charact
OS: XP
CPU/Ram: 256
Manufacturer/Model: 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


Report Offensive Message For Removal


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


Report Offensive Follow Up For Removal

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.


Report Offensive Follow Up For Removal

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


Report Offensive Follow Up For Removal







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



Results for: Batch delete first and last charact

sum of first and last numbers c++
    Summary: Hi, i need help. i need a hint or example to get the last number /and last two numbers. Problem: sum of first and last number in a c++ rogram. product of last two numbers. how can i get the last numb...
www.computing.net/answers/programming/sum-of-first-and-last-numbers-c/13997.html

Net User /ADD first and last name
    Summary: I was wondering if anyone knew how to add in the first and last names for new users via the Net User command line tool... ? Thanks... ...
www.computing.net/answers/programming/net-user-add-first-and-last-name/12638.html

Problem with recursion
    Summary: You have a good start, but your logic isn't quite right. First, why are you looping through each character in the string? Since this is supposed to be a recursive solution, iteration isn't allowed. ...
www.computing.net/answers/programming/problem-with-recursion/13116.html








Which MP3 player do you have?

iPod/iPhone
Zune
Something Else
None


View Results

Poll Finishes Today.
Discuss in The Lounge
Poll History






Data Recovery Software