Remove certain lines from a file

May 24, 2011 at 08:20:53
Specs: Windows XP
Hi,

I have a text file and I'd like to remove lines sarting with specific string e.g. 'prompt'.

Example:
- input: file.txt
one
two
prompt
three

- output: file.txt
one
two
three

Thanks


See More: Remove certain lines from a file

Report •


#1
May 25, 2011 at 04:17:38
Look at findstr /?


=====================================
Life is too important to be taken seriously.

M2


Report •

#2
May 25, 2011 at 07:25:12
thanks, this did the job:

findstr /v prompt file.txt >> newFile
move /y newFile file.txt


Report •

#3
May 25, 2011 at 07:36:58
If this is a typo: "remove lines sarting with" and really means STARTING with, you need:

findstr /v /b prompt file.txt


=====================================
Life is too important to be taken seriously.

M2


Report •

Related Solutions

#4
May 26, 2011 at 03:49:00
yes you're right, good to have someone to check my mistakes :)

Report •

Ask Question