|
LMM macro, introduced here, removes lines containg certain character string
in line positions of a (raw) text file.
The string and the line positions (criteria) are chosen by the user.
The lines of the orginal file are written into a new file
except those fulfilling the (removal) criteria.
The original file remains unchanged.
The new file bears the body of the name of the original file extended
with "_1." (e.g. sales.txt -> sales_1.txt).
|
|
|
Due to the functionality of IDEAScript each line of the new file
starts and ends with a quotation mark (").
As a result each file of the new file is two characters longer than the original line,
and the file size is bigger respectively.
|
|
|
The macro has been made with IDEA 2002.
It is possible that IDEAScript of newer IDEA versions are not able to execute the macro properly.
|
|
| Running the macro [1].
|
| - |
Start IDEA after unzipping the contents of LMM.ZIP to a folder that you prefer.
|
 |
| Picure 1 |
|
 |
| Picure 2 |
|
 |
| Picture 4 |
|
|
| - |
Select: Tools - Macros - Run.
In the dialog box select file type '*.ise' (a compiled macro)
and thereafter select LMM.ise as shown in the picture to the right (Picture 1).
|
| - |
You are first shown the macro information (Picture 2).
Click 'Select a File' to go on, and you are shown contents of 'lmm.txt' (not shown here).
Click 'OK' after reading it.
|
| - |
In the example here we have a data file 'G99A.TXT'.
It consists of 5.834 lines, each 242 characters long (not shown here).
We select this file and get the message in picture 3.
|
|
|
 | |
| Picture 3 |
|
|
| - |
We want to remove lines where there is text 'CFD01'
in positions 59-63. We submit this information and click 'OK' (Picture 4).
|
| - |
The macro performs its job quickly.
At the end of the run the macro gives us the message about the new file (picture 5).
|
|
|
 | |
| Picture 5 |
|
|
| - |
Because we ran macro's demo version only 500 first lines
of the original file were processed; in this case 159 lines were left uncopied
into the new file.
|
| - |
Finally we check the new file 'G99A_1.TXT': [2]
We open it with Notepad.
We can see that the lines start and end with quotation marks.
We can remove the quotation marks with RemQ.EXE [3].
|
|
| Download
|
|
|
You can download the macro here.
The zip file 'lmm.zip' contains files 'LMM.ise', 'lmm.txt' and 'readme_lmm.txt' and RemQ.EXE.
NOTE! If you make any change in 'lmm.txt' the macro cannot be run.
|
|
[1]
See also the instructions in the 'readme_lmm.txt' file.
Before running the macro you should also examine the orginal file to determine the criteria:
the string and its first position. IDEA's RDE has tools for this exercise.
|
|
[2] Link to the new file (G99A_1.TXT)
|
|
[3] Run 'RemQ.EXE' in MS-DOS environment.
It is easiest to copy 'RemQ' to the same folder
as the new file (to avoid to write potentially long path-to-file information).
|
 |
| Picture 6 |
|
|
Picture 6: Display during a run:
(1) Click 'RemQ.EXE' to start.
|
|
(2) Submit file names when prompted. RemQ shows the first line to be processed.
(3) RemQ tells about execution of the program.
(4) Finally RemQ shows the first line of the newest file (here: A.TXT).]
|
|