How to Locate the Largest Value in a Text File with EmEditor
How to Locate the Largest Value in a Text File with EmEditor
November 5, 2011 at 6:14 pm #9804
Participant
No, an RegEx is an pattern matching system only.
There are very little comparing features.
You will need to use an macro/script for that.
How that macro will work and what you will get as
result depends on your real current needs and how
the rest of the line looks a like: are that digits
and tabs the only signs in such an line?
Here is an quick example code.
Be sure to use this always with copies of your importent documents.
Because i don’t have an impression what could get worse.
If anyone should improve this script for you we will need an
better example how the rest of such an line will look a like.
Ahh, and this script will work only with tabs as delimiter
or it have to be adjusted as one needs.
////===== Description: ==================
//// Click into an line and execute this macro/script.
//// The line will split at tab stops
//// and if an part is detected as an number
//// the greatest number is stored as vBiggestNumber for your use.
//// ====== Setting: ====================
//// Split line at tab. Use your own delimiter if needed:
SplitAt = "t";
//// ====== Work: ======================
//// Get current line content:
document.selection.SelectLine();
CurrLine = document.selection.text;
//// Call function to split str and find biggest number:
vBiggestNumber = ReturnLargedNumber(CurrLine, SplitAt);
//// ====== End: =======================
//// Do something with the result:
alert('result: >' + vBiggestNumber + '<');
//document.selection.Collapse();
//document.selection.NewLine();
document.selection.text = vBiggestNumber;
////======================================
////======== Function =====================
function ReturnLargedNumber(str,delim)
Tokens = str.split(delim);
vMaxNumber = 0;
for (x = 0; x < Tokens.length; x++)
vCurrentNumb = Tokens[x];
if (!isNaN(vCurrentNumb))
if (Number(vCurrentNumb) > vMaxNumber)
vMaxNumber = vCurrentNumb;
return vMaxNumber;
HTH? :-D
Also read:
- [New] 2024 Approved Engaging YouTube Summaries with Tailored Templates
- [Updated] Drone Motors Choose the 5 Best Motors for Your Quadcopter for 2024
- [Updated] Top Editors for YouTube' Writers and Creators - All Free
- Assistance Required: Inserting Numbered Rows in an EmEditor Document Using a Macro
- Effective Remedies When Windows Explorer Frequently Fails - Uncover Secrets
- Efficiently Edit Your Documents at Home with EmEditor - A Comprehensive Text Editor Program
- EmEditor Text Editor Update: Introducing the Essential Unicode UTF8 Sort String Plugin!
- Get Your TP-Link Adapter Up to Date: Download Latest Drivers for Windows 11, 8 & 7
- How to Use EmEditor with Mapped Drives in Linux - A Text Editing Guide
- Professional Text Editing with EmEditor Version 7.00 BETA - Advanced Features
- Scripting Stimulating Screen-Grabbers
- Step-by-Step Guide: Adding Programming Codes Into Microsoft Word
- Troubleshooting EmEditor's Typographical Issue: Correcting an Erroneous Cursor Positioning Error
- Title: How to Locate the Largest Value in a Text File with EmEditor
- Author: Richard
- Created at : 2024-10-08 16:45:03
- Updated at : 2024-10-14 16:51:32
- Link: https://win-reviews.techidaily.com/how-to-locate-the-largest-value-in-a-text-file-with-emeditor/
- License: This work is licensed under CC BY-NC-SA 4.0.