I would like to do the following with the notepad editor.
0000129700001297
00001235 00001235
00001245 00001245
Numbers like the ones above
00001297
00001235
00001245
I'd like to have only one as shown in .
What are the alternatives?
I would like to do the following with the notepad editor.
Notepad (notepad editor) does not contain regular expressions.Use another tool.
Notepad++ allows you to use regular expressions (PCRE) for search and replacement, but you can also use PowerShell to handle this.
PowerShell script
Get-Content.\data.txt|
ForEach-Object {
$arr = $_-split "\s+"
If($arr[0]-eq$arr[1]){$arr[0]}Else{$_}
} |Out-File.\data_uniq.txt
data.txt
0000129700001297
00001235 00001235
00001245 00001245
00002000 00002001
data_uniq.txt
00001297
00001235
00001245
00002000 00002001
Provide detailed and accurate information about your environment when you ask questions.
The answer may vary depending on the regular expression engine.
Windows standard Notepad.exe does not support regular expressions, but questions are tagged "regular expressions" from the beginning, so assume you are using a different editor for regular expressions.Also, assume it is a typical ECMA regular expression engine.
I think you can do it with capture and partial strings.
Before replacement: ^([0-9]+)\s+\1$
After replacement:\1
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
915 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
578 Understanding How to Configure Google API Key
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.