Distance between grids
-
Searching for the biggest isn’t something the search engine can do.
With a bit of work, you should be able to sort by the distance, and find the biggest inside the active file.
For that,
- do a regular-expression search-and-replace to insert a copy of the distance-in-km to the beginning of the line:
- SEARCH =
(?-s)^.*(?<=~ )(\d+)(?=km)
- REPLACE =
$1\t$0
- MODE = regular expression
- SEARCH =
- Edit > Line Operations > Sort Lines as Integers (Descending): now the biggest distance will be first
Caveats: This won’t find the biggest across all files, just sort the active file. You’d have to do that for each file, and then manually compare the results across the files.
I don’t know your definition of “several” (5, 50, 500?). If you have more files than you are willing to do manually, I’d recommend finding your favorite programming language, and write up a script which can do the searching through all the files for you, rather than relying on manual regex+sort. This isn’t a general coding forum, so this isn’t the best place for help with that – though there are ways to script Notepad++, so that you could look for that across all the files open in Notepad++ (and doing it from the programming language, rather than requiring that the files be open in Notepad++, seems a more generic solution, especially if you are going to be doing it frequently.)
----
Do you want regex search/replace help? Then please be patient and polite, show some effort, and be willing to learn; answer questions and requests for clarification that are made of you. All example text should be marked as plain text using the
</>
toolbar button or manual Markdown syntax. Screenshots can be pasted from the clipbpard to your post usingCtrl+V
to show graphical items, but any text should be included as literal text in your post so we can easily copy/paste your data. Show the data you have and the text you want to get from that data; include examples of things that should match and be transformed, and things that don’t match and should be left alone; show edge cases and make sure you examples are as varied as your real data. Show the regex you already tried, and why you thought it should work; tell us what’s wrong with what you do get… Read the official NPP Searching / Regex docs and the forum’s Regular Expression FAQ. If you follow these guidelines, you’re much more likely to get helpful replies that solve your problem in the shortest number of tries. - do a regular-expression search-and-replace to insert a copy of the distance-in-km to the beginning of the line:
-
It’s a bit of a difficult problem, perhaps because something critical may have been left out of the problem statement.
But I’ll tell you the path I’d take with it.
I’d first get all the data in one place:
I’d do a Find in Files in Regular expression search mode for
~ \d{3}km$
in the top-level folder and of course allowing N++ to search subdirectories.This will get all of the necessary data into the Find result window. I’d move input focus to that window and do a Select All (ctrl+a) followed by a (right-click) Copy. I’d paste the result of that into a fresh N++ tab.
Then I’d do a replace operation by searching (in the same mode) for
(?-is)^.+~ (?=\d{3}km$)
and replace that with nothing. You’d want Wrap around ticked for this.This should leave you with a file of data that looks like this:
242km 201km
At which point you would sort the lines and then it should be easy to pick off the highest number visually.
To find where that high number originates, simply perform one more Find in Files on the literal text of that number, e.g.
~ 242km
-
@Alan-Kilborn Thanks Alan, only the first part has already solved my problem, because I need to keep the information of the lines, after I pasted in a new N ++ tab, edited and placed it in descending order … take care of yourself
-
@PeterJones Thanks Peter, I used Alan information, take care of yourself
-
Hello,@Francisco
Please try this code,To distance between gridsHtml code:
<div class="wrapper aligned"> <div class="box item1">One</div> <div class="box item2">Two</div> <div class="box item3">Three</div> <div class="box item4">Four</div> <div class="box item5">Five</div> </div>
Css code :
html { box-sizing: border-box; } *, *:before, *:after { box-sizing: inherit; } body { margin: 40px; } .wrapper { margin: 0 0 20px 0; width: 500px; height: 400px; border: 2px solid #CCC; display: grid; grid-gap: 10px; grid-template-columns: repeat(4, 80px); grid-template-rows: repeat(3,100px); align-content: space-around; justify-content: space-between; } .box { background-color: #444; color: #fff; border-radius: 5px; padding: 20px; font-size: 150%; } .item1 { grid-column: 1 / 5; } .item2 { grid-column: 1 / 3; grid-row: 2 / 4; } .item3 { grid-column: 3 / 5; }
I hope this code will be useful.
Thank you. -
@Alan-Kilborn Allan, GM, some lines have a small difference, the number 1, between the number “2” and the character “~” so these lines were selected … how to correct?
QSO 11: 144 PH 2020-06-14 1311 PT9VR 59 GG29QN PY5EK 59 GG43AM 2 1 ~ 724km Mult. ‘GG43’ band 144MHz (mult +1) -
@Makwana-Prahlad GM, thanks, sorry, its not how to use this scheme.
-
@Alan-Kilborn sorry, it also has a comma after km
QSO 11 : 144 PH 2020-06-14 1311 PT9VR 59 GG29QN PY5EK 59 GG43AM 2 1 ~724km, Mult. ‘GG43’ band 144MHz (mult +1) -
@Francisco said in Distance between grids:
sorry, it also has a comma after km
QSO 11 : 144 PH 2020-06-14 1311 PT9VR 59 GG29QN PY5EK 59 GG43AM 2 1 ~724km, Mult. ‘GG43’ band 144MHz (mult +1)
It also appears you no longer have the space between the
~
and the number of km. It’s hard to hit a moving target.Also, it would be really nice if you followed my original advice and used the forum’s toolbar or manual Markdown code to format your example text as text, so we could be sure that we were seeing what you were originally typing (the forum considers many characters and character-combos as special, and will make changes. For example, I am betting that you typed
'GG43'
with normal ASCII single quotes, but the forum sees quotes as something it can modify, so it presented it with so-called smart-quotes / curly-quotes, as‘GG43’
. If the quoting had ended up being important to your question (which it didn’t, in this instance), it could have sent us down the wrong path.It also makes the data stand out as data; see my modified-quote of your text.
I would change @Alan-Kilborn’s search regex to
(?-is)^.+~\h*(?=\d+km)
. Using the\h*
instead of a single space in the regex will allow there to be zero or more spaces between the tilde and the number. Using\d+
instead of\d{3}
means one or more digits (instead of his original exactly-three digits), which will allow~ 1km
or~ 1100km
to match, too (all your examples have been three digits so far… but given the moving goalposts you are setting, it wouldn’t surprise me if those changed). And removing the$
at the end of the lookahead means thatkm
doesn’t have to be the last token on the line, so things can come after thekm
. -
To quote myself:
@Alan-Kilborn said in Distance between grids:
…perhaps because something critical may have been left out of the problem statement.
:-)
Really my goal was just to lay the groundwork of an approach that could be used, on a problem that sounded like something a one-shot search operation can’t really accomplish.
Of course, as the “goalposts” move (LOL) maybe a simple-search would have been good enough? Really, though, still hard to tell.
I think we have a new idiom to join “baking cookies” and perhaps some others… : “moving goalposts”. BTW, it seems an oxymoron to “set” the “moving goalposts”. :-)
-
Sorry for the confusion, i don’t speak english, i’m using the google translator. The forum has already helped me a lot, with my difficulties, despite my 67 years, even on other occasions … I thank you for your patience. take careIt two lines, i send a copy and paste:
QSO 10 : 144 PH 2020-06-14 1219 PT9VR 59 GG29QN PT9AL 59 GG27OS 2 - ~200km
QSO 11 : 144 PH 2020-06-14 1311 PT9VR 59 GG29QN PY5EK 59 GG43AM 2 1 ~724km, Mult. ‘GG43’ band 144MHz (mult +1) -
@Francisco said in Distance between grids:
i send a copy and paste:
QSO 10 : 144 PH 2020-06-14 1219 PT9VR 59 GG29QN PT9AL 59 GG27OS 2 - ~200km
QSO 11 : 144 PH 2020-06-14 1311 PT9VR 59 GG29QN PY5EK 59 GG43AM 2 1 ~724km, Mult. ‘GG43’ band 144MHz (mult +1)Please use the toolbar button
</>
to format your text:
The regex I supplied above,
- FIND =
(?-is)^.+~\h*(?=\d+km)
will find the distances in the following text:
QSO 10 : 144 PH 2020-06-14 1219 PT9VR 59 GG29QN PT9AL 59 GG27OS 2 - ~200km QSO 11 : 144 PH 2020-06-14 1311 PT9VR 59 GG29QN PY5EK 59 GG43AM 2 1 ~724km, Mult. 'GG43' band 144MHz (mult +1)
However, if you want to leave only the distances, as @Alan-Kilborn’s original regex was meant to do, edit it slightly:
- FIND =
(?-is)^.+~\h*(\d+km).*$
- REPLACE =
$1
- MODE = regular expression
Good luck
- FIND =
-
@PeterJones
FIND = (?-is)^.+~\h*(?=\d+km)
I hope I got it right in the reply, Peter just this command resolves to, thank you very much. GL