Deleting lines with IPv6 in them

May 21, 2010 at 13:42:42
Specs: Windows Vista
Hi, i have a set of files with a load of guff in them eg.
Link-local IPv6 Address . . . . .
IPv4 Address. . . . . . . . . .
IPv6 Address. . . . . . . . . .
Link-local IPv6 Address . . . .
Link-local IPv6 Address . . . .

and i also have the beginnings of some code for it:

FINDSTR "IPv6" *.txt

now all i need is some small snippet to delete the lines that contain the "IPv6", this load of messages is in several files, hence the *.txt


See More: Deleting lines with IPv6 in them

Report •

#1
May 21, 2010 at 13:45:53
i know theres about 5000000 topics about deleting lines in code, but none of them seem to helo for what i want, i hope things dont get too repetitive...

i forgot to mension that im only a basic .bat code monkey, and would preferably like some code thats easy to learn, not the whole strings of code that i have seen, if possible that is...


Report •

#2
May 21, 2010 at 14:12:22
@echo off & setLocal enableDELAYedeXpansion

for /f "tokens=* delims= " %%a in ('dir/b *.txt') do (
find /v "IPv6" < %%a > newfile
move /y newfile %%a
)


=====================================
Helping others achieve escape felicity

M2


Report •

#3
May 21, 2010 at 14:16:10
i know this may sound stupid but exactly how does this work? imean all the tokens stuff and the newfile syntax realy just a walk through if you dont mind too much.
apreciate it
Arthur

Report •

Related Solutions

#4
May 21, 2010 at 14:20:52
tokens=* means 'use the whole line'.

move /y newfile tells it to write the NEWFILE just created over the original.


=====================================
Helping others achieve escape felicity

M2


Report •

#5
May 21, 2010 at 14:41:48
Thanks, makes it much clearer :) cheers

Report •

#6
May 21, 2010 at 18:00:33
grep -v "IPv6" *.txt

Of course, "grep" isn't shipped with Windows. You need to download it from a free software site (FSF, GNU, etc.).


Report •

Ask Question