Computing.Net > Forums > Programming > I need to delete text from a file..

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.

I need to delete text from a file..

Reply to Message Icon

Name: El-Trucha
Date: June 22, 2004 at 14:39:44 Pacific
OS: Windows XP
CPU/Ram: 1.4 GHz/224 MB
Comment:

Hello every1!!
Look, I need to remove all lines that say "Echo is off." from a text file using Batch.
How can I do this??
Thanx!! ;)

El-Trucha



Sponsored Link
Ads by Google

Response Number 1
Name: dtech10
Date: June 22, 2004 at 15:35:46 Pacific
Reply:

Hi
Try something like this.
type OldFile | find /v /i "Echo is off" > NewFile

NewFile will contain every line minus the "Echo is off" lines.



0

Response Number 2
Name: Mechanix2Go
Date: June 23, 2004 at 00:15:37 Pacific
Reply:

Hi,

dtech is right.

But does you batch file really have such lines, or is it putting out 'echo is off'?

If echo is off and you have a line like this:

echo

with nothing else after it, it will put out the msg 'echo is off'

If that's the case and you really want a line which puts out a 'blank' line, use:

echo.

HTH

M2


0

Response Number 3
Name: El-Trucha
Date: June 23, 2004 at 13:17:51 Pacific
Reply:

No...I'm making a batch file which makes another batch file with user input, but the file gives the option to select which files to use.
For example,
------------------------
echo Do you want to put a welcome message??
choice /c:yn
if errorlevel 2 goto label
set /p message=What's your message gonna b??
...
echo %message%
------------------------
But the problem is that if %message% doesn't exist, it will say "Echo is off" on the output file!!! :(
So I will try that solutionn!! thanx!! ;)

El-Trucha


0

Response Number 4
Name: El-Trucha
Date: June 23, 2004 at 13:39:37 Pacific
Reply:

YESSSSSSS!!!!!!!! IT WORKED!!!!
MUCH MUCH MUCH MUCH THANX!!!!!!!!!!!!!! ;)

El-Trucha


0

Response Number 5
Name: dtech10
Date: June 23, 2004 at 15:39:54 Pacific
Reply:

Hi
You could use this to stop echoing the
"echo is off" statement.

if not "%message%"=="" echo %message%



0

Related Posts

See More



Response Number 6
Name: El-Trucha
Date: June 23, 2004 at 18:12:10 Pacific
Reply:

Ooohh...ok!! thanx!! ;)

El-Trucha


0

Response Number 7
Name: tImmaY
Date: June 27, 2004 at 05:49:18 Pacific
Reply:

OK so lets say that you moved all of your music files from one folder to a dif. folder where the rest of your music files are. ya know, just doing some spring cleaning.. but then you have a winamp playlist that has the destination of half of your songs going to the wrong file and you have playlist thats lets say.. ooh.. 1000 songs long..

using the above method of removing the phrase "My Shared Folder" each time it appears actually deletes every line that it appears in, not just the phrase..

so is there a way that you could have a batch file delete just the "My Shared Folder" and/or replace the phrase with "My Music"?


0

Response Number 8
Name: El-Trucha
Date: June 27, 2004 at 15:32:08 Pacific
Reply:

R u talkin about the name of the folder??

El-Trucha


0

Response Number 9
Name: tImmaY
Date: June 27, 2004 at 22:29:37 Pacific
Reply:

yea, like if you open up a winamp playlist in notepad its just a lil info for winamp and then the file info for each song. on one line is like the \My Shared Folder\baby_got_back.mp3 or w/e


0

Response Number 10
Name: El-Trucha
Date: June 28, 2004 at 10:22:47 Pacific
Reply:

Ooohh...ok!! and u want 2 change My Shared Folder for My Music...hmm...I don't know...sorry... :(

El-Trucha


0

Sponsored Link
Ads by Google
Reply to Message Icon






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: I need to delete text from a file..

Win32: Reading a texts from a file www.computing.net/answers/programming/win32-reading-a-texts-from-a-file/11673.html

How to import data from a webpage www.computing.net/answers/programming/how-to-import-data-from-a-webpage-/8773.html

Reading data from a file by using batch file www.computing.net/answers/programming/reading-data-from-a-file-by-using-batch-file/19995.html