I have a very large notepad ++ file (over 100000 lines) and was wondering if there was a way to change the order of the lines in a way so every line is randomly changed.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I also need to put these lines in quotes. I could find every line with .* in regex, but I'm not sure what to replace it with to make every line appear in quotes.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
For the second post: replace with "\0" -> a double quote, the whole matching pattern and a second adouble quote.
About the first question: this is typically a job for a scrit. There are plugins supporting various scripting languages - PHP, Python, JS -, or you can simply drive an external script engine from N++ using NppExec.
CChris
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I found a very simple script that someone claimed would do this:
sort -R FILE
But honestly I'm not sure what scripting language it's for. The site I found it on siad it deals with CLI (Command-line interface) but gave no mention of which specific language.
If this command looks like it comes from a specific programming launguage and anyone has any idea which one I would love to figure that out.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The most efficient way to accomplish this, is to use a regular replace mode, not regular expression mode.
Move the cursor to the top of the document (Ctrl+Home) or check the Wrap option.
In the Text FX Find/Replace Dialog (Ctrl+R):
- in the Find Field, press Ctrl+M or Ctrl+Enter
- in the Replace Field, type ", press Ctrl+M or Ctrl+Enter, and type " again.
Press Find, then Replace Rest.
Now you only have to add a double quote character at the very start and end (Ctrl+End) of your document.
This skips looking for complete lines and replacing each one with just a little more than its original contents.
2. Unsorting a file
There is an unsort utility for non-Windows systems, but I guess this won't be of much help.
However, I came up with a pseudo-unsort idea. If the lines of your file all have a certain minimum length, you may be helped by sorting them starting from a certain character position.
You can do this in Notepad by selecting all lines from the end of the document (Ctrl+End), pressing and holding the Shift key and then Ctrl+Home and moving the cursor caret to the desired position in the first line. You can then use either of the Text FX sorting options "(at column)". Be aware, for a large file this may take some time!
You can also use the Windows command line/prompt sort.exe utility. Open a Command Prompt window (Start / Execute: cmd) and type sort /?. You will get some help text then.
You could use the following command:
sort /+# inputfilename /o outputfilename
# = starting column/position to perform the sort on, skips the first (# - 1) characters on each line
inputfilename = guess what
outputfilename = guess what
The results will be in a "fixed" order, but you could vary this by applying different # values and additionally by applying the /r (reverse order) option.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I was unable to find a solution for notepad++, but you can easily randomize lines is with the online sort lines tool.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2012-08-18
if you work with large file online tool will crash your browser, try TED Notepad _http://jsimlo.sk/notepad/features.php it can shuffle / randomize line
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a very large notepad ++ file (over 100000 lines) and was wondering if there was a way to change the order of the lines in a way so every line is randomly changed.
I also need to put these lines in quotes. I could find every line with .* in regex, but I'm not sure what to replace it with to make every line appear in quotes.
For the second post: replace with "\0" -> a double quote, the whole matching pattern and a second adouble quote.
About the first question: this is typically a job for a scrit. There are plugins supporting various scripting languages - PHP, Python, JS -, or you can simply drive an external script engine from N++ using NppExec.
CChris
I found a very simple script that someone claimed would do this:
sort -R FILE
But honestly I'm not sure what scripting language it's for. The site I found it on siad it deals with CLI (Command-line interface) but gave no mention of which specific language.
If this command looks like it comes from a specific programming launguage and anyone has any idea which one I would love to figure that out.
1. Quoting complete lines
The most efficient way to accomplish this, is to use a regular replace mode, not regular expression mode.
Move the cursor to the top of the document (Ctrl+Home) or check the Wrap option.
In the Text FX Find/Replace Dialog (Ctrl+R):
- in the Find Field, press Ctrl+M or Ctrl+Enter
- in the Replace Field, type ", press Ctrl+M or Ctrl+Enter, and type " again.
Press Find, then Replace Rest.
Now you only have to add a double quote character at the very start and end (Ctrl+End) of your document.
This skips looking for complete lines and replacing each one with just a little more than its original contents.
2. Unsorting a file
There is an unsort utility for non-Windows systems, but I guess this won't be of much help.
However, I came up with a pseudo-unsort idea. If the lines of your file all have a certain minimum length, you may be helped by sorting them starting from a certain character position.
You can do this in Notepad by selecting all lines from the end of the document (Ctrl+End), pressing and holding the Shift key and then Ctrl+Home and moving the cursor caret to the desired position in the first line. You can then use either of the Text FX sorting options "(at column)". Be aware, for a large file this may take some time!
You can also use the Windows command line/prompt sort.exe utility. Open a Command Prompt window (Start / Execute: cmd) and type sort /?. You will get some help text then.
You could use the following command:
sort /+# inputfilename /o outputfilename
# = starting column/position to perform the sort on, skips the first (# - 1) characters on each line
inputfilename = guess what
outputfilename = guess what
The results will be in a "fixed" order, but you could vary this by applying different # values and additionally by applying the /r (reverse order) option.
I was unable to find a solution for notepad++, but you can easily randomize lines is with the online sort lines tool.
if you work with large file online tool will crash your browser, try TED Notepad _http://jsimlo.sk/notepad/features.php it can shuffle / randomize line