About replacing abnormal values with arbitrary symbols or blanks

Asked 2 years ago, Updated 2 years ago, 77 views

Suppose there exists an example of the observed value data (nxm, but m=1) for the following matrix in the CSV file:
1
100
200
1000
Is the abnormal value of 50 or less or 500 or more replaced with NA or blank in the Emeditor?
NA
100
200
NA
Or

100
200

The output is required.The reason why 0 is not allowed is because 0 is calculated when other programs read this CSV file and calculate the average and other statistics, including abnormal values.
0
100
200
0
So the average is 75, but
NA (or blank)
100
200
NA (or blank)
The average is 150.

emeditor

2022-09-30 16:32

1 Answers

You can do it by following the steps below.

Enter EmEditor numeric range

If you want to do this all at once, you can also create and run macros such as:To run this macro, first save the following macros under a filename, such as ReplaceNumber.jsee.Then select Select from the Macros menu to select the saved macro.Then, when you open the CSV file in CSV cell selection mode, click heading in the appropriate column to select the column, and then select Run from the Macro menu.

batch_list=editor.filters;
batch_list.AddReplace("[500,]", "NA", 0, eExFindNumberRange);
batch_list.AddReplace("[,50]", "NA", 0, eExFindNumberRange);
document.selection.BatchReplace(batch_list,eeFindReplaceSelOnly |eeReplaceAll, 0);

[Customize] If you set Average on the Status page of the dialog, the status bar displays the average value of the selection.

Customization-Status-Average Number of Choices


2022-09-30 16:32

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.