Re: How to quickly reverse the order of numbers in a text editor?

Posted: Tue Jun 25, 2019 5:55 pm

by Debugger

In this case, I would have to modify the script each time, adding numbers to the lines. And it would not be possible to just paste the numbers in the window, at any time and at any time, any numbers and click: run?

Re: How to quickly reverse the order of numbers in a text editor?

Posted: Tue Jun 25, 2019 6:05 pm

by therube

and then sort them

Should it be sorted or reversed?
22,34,50,15,27,74,29,25,77,6,54,40,38,73,9,67,57,70,58,60
60,58,70,57,67,9,73,38,40,54,6,77,25,29,74,27,15,50,34,22

(The missing post was a spammer.)

Re: How to quickly reverse the order of numbers in a text editor?

Posted: Tue Jun 25, 2019 7:27 pm

by vsub

By "and then sort them" I mean,it reverses the order...last is first

Debugger you don't need to edit the code every time,this was just an example
1.Remove the first line
2.Copy the numbers in your text editor and then run the scrips

There are man ways to make it work,I just don't know what you want to do with the values after you rearrange them
For example with this if you copy the values and then Press Shift+F1(the hotkey can be different),the script will rearrange the values and replace them

Re: How to quickly reverse the order of numbers in a text editor?

You are not serious, you give some code, and you think that the other person will understand how to use it. Master, give me some corrections. Do something.

Re: How to quickly reverse the order of numbers in a text editor?

Posted: Thu Jun 27, 2019 5:40 pm

by vsub

I am serious but you have to follow the thread
After I posted my first example,you said

In this case, I would have to modify the script each time, adding numbers to the lines. And it would not be possible to just paste the numbers in the window, at any time and at any time, any numbers and click: run?

And then I reply to that with what you have to do to be able to make the code work the way you want.

Debugger you don't need to edit the code every time,this was just an example
1.Remove the first line
2.Copy the numbers in your text editor and then run the scrips

Then I posted another code that allows you to execute that reordering and automatically replace the selected

If you want directions
First code:
1.Remove the file line and save the file
2.Select your numbers
3.Run the script
4.When the message box appear and when you hit ok,the rearranged digits will be placed into the clipboard which you can paste wherever you want

Second code:
1.Run the script(this example don't need the script to be started every time,when you start this once,it will always run and wait for you to press Shift+F1
2.Select your digits
3.Without deselecting them(clicking somewhere else),press Shift+F1 and release the buttons to run the code which will rearrange them and replace what you have selected

Re: How to quickly reverse the order of numbers in a text editor?

Posted: Fri Jun 28, 2019 2:07 pm

by vsub

@therube I am not sure how to test this but is this actually working when the values are random,not sequential like 1,2,3,4
When they are ordered from smaller\bigger to bigger\smaller number,then there are plenty of ways to do it

Can your example reverse the order like my script and when the values are separated by coma,not new line?

22,34,50,15,27,74,29,25,77,6,54,40,38,73,9,67,57,70,58,60
to
60,58,70,57,67,9,73,38,40,54,6,77,25,29,74,27,15,50,34,22

Can your example reverse the order like my script and when the values are separated by coma,not new line?

The source file (aka "file", in my example) is just as you show, a single line separated by commas.
I split the file at the commas, into separate lines, only because it makes it easier to parse (to reverse the order - that's what the tac command does -- tac is the reverse of cat, BTW).
After things are reversed, I then recombine them from individual "lines" back into a single line, separated by commas.
(All this is done in a stream.)

So long as your editor can make a system call... In Vim !!reverse.bat does that (for the current line, the line you want reversed).