Long time lurker, but could not find an answer to my problem for once (unless I did not look hard enough). I am attempting to create a script that will search for a specific value only in certain columns, and once found, delete that line of text.
So far I have the below (pretty sure I pulled most of this from Mofi):
This will remove any line of data that contains the input value, but I need to confine the search to only specific columns, not the entire file.
Adding to that, once the line that contained the specific value has been deleted, I need to have every other line (so skip a line, delete a line, skip a line, etc.) after that deleted as well.
Hope this makes sense. Any input would be greatly appreciated. Many thanks.
UltraEdit Professional Text/HEX Editor
Version 22.10.0.10
Windows 10, 64-Bit
So far I have the below (pretty sure I pulled most of this from Mofi):
Code: Select all
if (UltraEdit.document.length) {
UltraEdit.insertMode();
if (typeof(UltraEdit.columnModeOff) == "function") UltraEdit.columnModeOff();
else if (typeof(UltraEdit.activeDocument.columnModeOff) == "function") UltraEdit.activeDocument.columnModeOff();
UltraEdit.perlReOn();
UltraEdit.activeDocument.top();
var sUserString = UltraEdit.getString("What is the first node position to be deleted??",1);
var sDelString = sUserString.replace(/([$()*+.?\[\]\\{|}\^])/g,"\\$1");
UltraEdit.activeDocument.findReplace.mode=0;
UltraEdit.activeDocument.findReplace.matchCase=false;
UltraEdit.activeDocument.findReplace.matchWord=false;
UltraEdit.activeDocument.findReplace.regExp=true;
UltraEdit.activeDocument.findReplace.searchDown=true;
UltraEdit.activeDocument.findReplace.searchInColumn=false;
UltraEdit.activeDocument.findReplace.preserveCase=false;
UltraEdit.activeDocument.findReplace.replaceAll=true;
UltraEdit.activeDocument.findReplace.replaceInAllOpen=false;
var sSearchString = "^.*" + sDelString + ".*(?:\\r?\\n|\\r)";
UltraEdit.activeDocument.findReplace.replace(sSearchString,"");
}
Adding to that, once the line that contained the specific value has been deleted, I need to have every other line (so skip a line, delete a line, skip a line, etc.) after that deleted as well.
Hope this makes sense. Any input would be greatly appreciated. Many thanks.
UltraEdit Professional Text/HEX Editor
Version 22.10.0.10
Windows 10, 64-Bit