This task can be done with following script using English UltraEdit.
Code: Select all
var sNPIListing = "C:\\Temp\\NPIListing.csv";
if (UltraEdit.document.length > 0)
{
UltraEdit.perlReOn();
UltraEdit.insertMode();
UltraEdit.columnModeOff();
UltraEdit.document[0].selectAll();
var asNumbers = UltraEdit.document[0].selection.split("\r\n");
if (!asNumbers[asNumbers.length-1].length) asNumbers.pop();
// Remove first line with the string NPIL.
if (asNumbers.length > 0) asNumbers.splice(0,1);
UltraEdit.document[0].top();
UltraEdit.frInFiles.directoryStart="";
UltraEdit.frInFiles.useEncoding=false;
UltraEdit.frInFiles.searchInFilesTypes=sNPIListing;
UltraEdit.frInFiles.filesToSearch=0;
UltraEdit.frInFiles.ignoreHiddenSubs=false;
UltraEdit.frInFiles.displayLinesDoNotMatch=false;
UltraEdit.frInFiles.matchCase=true;
UltraEdit.frInFiles.reverseSearch=false;
UltraEdit.frInFiles.matchWord=false;
UltraEdit.frInFiles.openMatchingFiles=false;
UltraEdit.frInFiles.useOutputWindow=false;
UltraEdit.frInFiles.searchSubs=false;
UltraEdit.frInFiles.regExp=true;
var nNumber = 0;
var nTotalNumbers = asNumbers.length;
while (nNumber < asNumbers.length)
{
var sFind = "^(?:";
var bAddVerticalBar = false;
var nLastNumber = ((nNumber+50) < nTotalNumbers) ? (nNumber+50) : nTotalNumbers;
while(nNumber < nLastNumber)
{
if (bAddVerticalBar) sFind += "|";
sFind += asNumbers[nNumber].replace(/([.+])/g,"\\$1");
bAddVerticalBar = true;
nNumber++;
}
sFind += ")\\b";
UltraEdit.frInFiles.find(sFind);
}
UltraEdit.activeDocument.top();
UltraEdit.activeDocument.findReplace.mode=0;
UltraEdit.activeDocument.findReplace.matchCase=true;
UltraEdit.activeDocument.findReplace.matchWord=false;
UltraEdit.activeDocument.findReplace.regExp=true;
UltraEdit.activeDocument.findReplace.searchDown=true;
if (typeof(UltraEdit.activeDocument.findReplace.searchInColumn) == "boolean")
{
UltraEdit.activeDocument.findReplace.searchInColumn=false;
}
UltraEdit.activeDocument.findReplace.preserveCase=false;
UltraEdit.activeDocument.findReplace.replaceAll=true;
UltraEdit.activeDocument.findReplace.replaceInAllOpen=false;
UltraEdit.activeDocument.findReplace.replace("^(?:(?:-----|Find|Found|Search).*\\r\\n)+","");
UltraEdit.activeDocument.top();
UltraEdit.activeDocument.findReplace.replace("^.+?\\(\\d+\\): ","");
UltraEdit.activeDocument.top();
}
Please edit at top of the script the path of the file
NPIListing.csv containing 6 million lines or copy the file into directory
C:\Temp\. For each backslash (directory separator) one more backslash must be entered for a valid path string.
The file
NPIL.csv with the about 21,000 lines (numbers/values) must be opened in UltraEdit as first file (most left on file tabs bar).
The second file should be the script file with the code above. Run the script with a click on item
Play script on ribbon tab / contemporary menu
Advanced or with a click on menu item
Run active script in menu
Scripting on using toolbar/menu mode with traditional menus.
Let me know if you are interested in comments explaining how the script works.