Tag Info

Hot answers tagged

13

Re-ordering Columns in a Text File Yes this is possible within vanilla Notepad++, though as noted there are also plugins that will do it. A better (more robust) approach might be to use some command-line text-processing tools, but if you need a quick-and-dirty solution you can find that below: Assuming your exact input (col1|col2|col3, pipe delimeter, no ...


3

Press Home then Shift+End. End then Shift+Home can also be used. If you need to select the line from the very beginning instead of the first indented character, press Home twice. This can also be recorded as a macro then set a shortcut to that macro. However Ctrl+A is used to select all in almost all text editors and text boxes. Changing it could make ...


3

Find: ([^\|]*\|[^\|]*)\| Replace to: \1\n


3

The batch file is working correctly. find won't count a line unless it has the Windows LFCR* symbols on the line. You need to change the text file to have the LFCR symbols at the end of each line. *LFCR is Line Feed, Carriage Return.


2

Try this for your search text: 000\\000\\(\d+)\\ or this 000\\000\\(\d\d\d)\\ And this for your replace text: 000\\000\\\1\\\r or 000\\000\\\1\\\n In order to replace text in a regular expression, you need to identify what you want to replace. You were just missing the parenthesis. The parenthesis identifies the enclosed regular expression as the ...


2

I want to remove all of the useless stuff that I dont need I know how to get rid of the </option> quite easily, but I don't know an easy way to get rid of the <option value="different value each time">. Also, is it possible to put each value on its own line once the <option value='different value each time"> has been removed? ...


2

I want to replace every second instance of | with a new line Menu "Search" > "Replace" (or Ctrl + H) Set "Find what" to (.*?\|.*?)[\|] Set "Replace with" to \1\r\n Enable "Regular expression" Click "Replace All" Before: Name1|Value1|Name2|Value2|Name3|Value3 After: Name1|Value1 Name2|Value2 Name3|Value3 Notes: The above assumes you are editing ...


1

I want to replace the 1s with a pattern of 1 2 3 Menu "Search" > "Replace" (or Ctrl + H) Set "Find what" to (.*?)1\r\n(.*?)1\r\n(.*?)1\r\n Set "Replace with" to \11\r\n\22\r\n\33\r\n Enable "Regular expression" Click "Replace All" Before: 1. 1 2. 1 3. 1 4. 1 5. 1 6. 1 7. 1 8. 1 9. 1 After: 1. 1 2. 2 3. 3 4. 1 5. 2 6. 3 7. 1 8. 2 9. 3 Further ...


1

Notepad++ inserts REM as the comment marker. I would prefer to have ' Open the Notepad++ language config file "langs.xml" Find <Language name="vb" ext="vb vbs" commentLine="REM" commentStart="" commentEnd=""> Change commentLine="REM" to commentLine="'" Save changes Restart Notepad++ Source Change comment character in notepad++ by rafiki Where ...


1

Install below notepad++ xml tools libraries from sourceforge


1

I found the answer here: Setting Notepad++ find results style This allows you to adjust all of the coloring/highlighting aspects of the find box. Also, I still had to make one change in the Global Styles language under "Default Styles" to finally get the lines to appear. HTH someone else.


1

Well, you haven't captured anything to store to be referenced by the \1 and \2 and \3 that's why you appear to lose things when you try to refer to them in the replace. Use round brackets(parentheses) in the find section around what you want to keep for \1 and \2 and \3 like this It's not quite clear what you want to do, but here's an example And you ...


1

recently I got same problem. As I think the easiest way is to write simple .bat file something like this: ... SET var1="C:\Users\churaev.s\Desktop\a01_strt.bat" SET var2="C:\Users\churaev.s\Desktop\b02_code.mat" SET var3="C:\Users\churaev.s\Desktop\c03_data.txt" ... START "" "C:\Program Files (x86)\Notepad++\notepad++.exe" %var1% START "" "C:\Program ...


1

For me, using Win 7, I had to use \r for the search and empty for the replace.


1

Using 'find and replace' in regular expression mode: Find what: (.*aaa) Replace with: //\1 Click on 'Replace All'


1

You can do this with a regular expression search and replace. Press Ctrl+H to open the Replace dialog. Make sure search mode is Regular Expression. Find what: (^[^\t\r\n]+\t)[^\t\r\n]+(\(\w+\d+:\w+\d+\))[^\t\r\n]* Replace with: \1\2 Explanation of the pattern: [^\t\r\n]+ is any string of characters that doesn't contain a tab or newline or carriage ...


1

Is there a way to force notepad++ to treat .txt files as VBS? Use the "Style Configurator" dialog: Go to "Settings" > "Style Configurator" Select "Language" > "VB / VBS" Add "txt" to "User ext:." Click "Save & Close"


1

Yes, there is. In Backup page of Preferences, be sure you check Remember current session for next launch Enable session snapshot and periodic backup Then Notepad++ exits immediately without asking. Open documents are retained, but it is as easy as pressing Ctrl+W to close them. You can also assign some shortcut to Close All command (suggestion: ...


1

Find what: (@.*?@.*?@.*?@.*?@.*?\s) Replace with: \1\r\n Option Regular expression must be checked Before After Note: There might be a cleaner solution by counting occurrences @{5} together with a look-ahead. But Notepad++ uses the Scintilla regex engine and its still a limited one even in newer versions where they changed a lot regarding regex


1

Find / Replace Repeated IDs in CSV The not-entirely-optimised-but-functional regex I used was: (GO:[\d]+),(GO:[\d]+)(.*) replacing with: $1$3\n$2$3 Giving the output: ID, term, functional category GO:0008166,viral replication,P, GO:0008167,sigma virus replication,P, GO:0008168,methyltransferase activity,F, GO:0004480,methyltransferase activity,F, ...


1

As discussed in the comments of the question, here's the bash script that would fulfil this purpose. Cheers #!/bin/bash ### set input and output file names input=test.txt output=pause.txt ## run the script while read foo; do echo $foo >> $output if [ "$(echo $foo | grep date)" != "" ] then echo "pause" >> $output fi done < $input ...


1

How do I insert a line before another line which matches a pattern? Menu "Search" > "Replace" (or Ctrl + H) Set "Find what" to ^(date.*)$ Set "Replace with" to pause\r\n\1 Enable "Regular expression" Click "Replace All" Notes: The above assumes you are editing a text file with Windows EOLs, \r\n. If you are using files with different EOLs you can ...


1

This will put a matching closing tag at the end of every line. Go to search/replace and choose regex as the search mode. Find what: ^<(.+)>(.+)$ Replace with: <\1>\2</\1> The find what looks for the opening tag at the beginning of the line, and stores it in \1, and puts the rest of the line in \2 We then create the new line in the ...



Only top voted, non community-wiki answers of a minimum length are eligible