Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.
remove string values from text file
Name: theblack.fox Date: September 18, 2007 at 15:21:19 Pacific OS: Windows XP CPU/Ram: 512MB Product: Dell
Comment:
I need a batch script that will remove a set of ip address out of a txt file. these ip address need to be defined in another text file or in the script
is this possible? im a complete noob, so i need some help thanks
Name: tonysathre Date: September 18, 2007 at 15:56:34 Pacific
Reply:
You mean like this:
type file.txt > newfile.txt
You query is not clear. Please provide some additional information so we can better understand your problem.
The above simply types the contents of file.txt and redirects the output from STDOUT to newfile.txt.
"Computer security." — Oxymoron
0
Response Number 2
Name: theblack.fox Date: September 19, 2007 at 02:16:52 Pacific
Reply:
ok say i have two files
computerlist.txt and exclusionlist.txt
i want a batch to look at the exclusionlist.txt and remove all the values inside from the computerlist.txt
0
Response Number 3
Name: ghostdog Date: September 19, 2007 at 02:20:25 Pacific
Reply:
here's a vbscript to find IP address and output to file. [code] Dim objRe,objFSO Dim myFile myFile = "c:\test.txt" Set objFSO=CreateObject("Scripting.FileSystemObject") Set objRe = New RegExp objRe.Pattern = "\b(?:\d{1,3}\.){3}\d{1,3}\b" objRe.Global = True strLines = objFSO.OpenTextFile(myFile,1).ReadAll Set Matches = objRe.Execute(strLines) For Each match In Matches WScript.Echo match Next [/code] usage: cscript myscript.vbs > outfile
0
Response Number 4
Name: theblack.fox Date: September 20, 2007 at 01:53:17 Pacific
Reply:
anyway to do it in a batch script?
0
Response Number 5
Name: ghostdog Date: September 20, 2007 at 02:26:27 Pacific
Reply:
sure, but i will not be the one to do it :) please wait.
0
Response Number 6
Name: tonysathre Date: September 23, 2007 at 23:57:07 Pacific
Reply:
::==rmdup @echo off if exist computerlist.txt ( rename computerlist.txt computerlist.tmp ) findstr /v /g:exclusionlist.txt computerlist.tmp >> computerlist.txt if exist computerlist.tmp ( del computerlist.tmp )
"Computer security." — Oxymoron
0
Response Number 7
Name: theblack.fox Date: September 26, 2007 at 14:37:46 Pacific
Reply:
tonysathre you are a genius!
thankyou
0
Response Number 8
Name: tonysathre Date: September 26, 2007 at 15:57:00 Pacific
Reply:
That little script actually took me a long time to figure out because I didn't know about the /g switch of the findstr command.
Summary: I have a batch file that merges multiple text files into one. It works great excpet for the "blank box" at the end of the file. The last line of each individual file (*.idx) is blank. If I remove t...
Summary: Hi, I am newbie to python and using python to find a string in a text file which looks like this processA=logfileA processB=logfileB What I want is to get the logfile name for the search string (Proce...