Greetings!
I'm a new user and I have not much experience in programming. What I want to do is a simple job but I haven't been able to figure it out on my own - it's probably a very easy thing for most users...
Here is the file that I have;
x323,x234,x932,x991
x234,x323,x991
x139,x234
..
What I want to do is the following:
for each line (there are about 400000 lines in this file), get the line number
find the first word in each line
replace all instances of this word in this entire file with the line number
then go to the next line, repeat till the end of file
Basically I am trying to replace all these names with serial numbers (same as the line number)
Here is the code that I wrote;
=================
var index;
for (index = 1; index < 4000; index++) {
UltraEdit.activeDocument.gotoLine(index,1);
UltraEdit.activeDocument.selectWord;
var text = UltraEdit.activeDocument.selection;
UltraEdit.activeDocument.findReplace.replace(text,index);
}
============
I guess I messed up "text" and "index"; but I still can't figure out how to make it work
Thanks a lot!
Rick
I'm a new user and I have not much experience in programming. What I want to do is a simple job but I haven't been able to figure it out on my own - it's probably a very easy thing for most users...
Here is the file that I have;
x323,x234,x932,x991
x234,x323,x991
x139,x234
..
What I want to do is the following:
for each line (there are about 400000 lines in this file), get the line number
find the first word in each line
replace all instances of this word in this entire file with the line number
then go to the next line, repeat till the end of file
Basically I am trying to replace all these names with serial numbers (same as the line number)
Here is the code that I wrote;
=================
var index;
for (index = 1; index < 4000; index++) {
UltraEdit.activeDocument.gotoLine(index,1);
UltraEdit.activeDocument.selectWord;
var text = UltraEdit.activeDocument.selection;
UltraEdit.activeDocument.findReplace.replace(text,index);
}
============
I guess I messed up "text" and "index"; but I still can't figure out how to make it work
Thanks a lot!
Rick