Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

744.Text sort -- How to sort numbers by the order of distance from some number?

User: editor -- 2011-03-24          << 743  745 >>
Hits: 1912
Type: Text sort   
Search all Text sort examples
Description:
How to sort a serial of numbers, by the order of the value of following functions: abs(number-10).
The number that is closer to 10 will have a higher order.
Input Sample:
9
12
20
18
0
7
4
5
10
21
6
8
13
22
Output Sample:
10
9
12
8
7
13
6
5
4
18
20
0
21
22
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-o open the text file that contains numbers
2. ctrl-h open 'replace' dialog
* set 'replace with pattern' to:

* click 'advanced' tab
* set 'run following at the beginning of replace' to:

3. click 'replace', done!

Screenshot 1:  Replace_Window


Screenshot 2:  Replace_Advanced_Window


Similar Examples:
How to find missing numbers from a list of numbers? (61%)
How to count the number of words that started with "en"? (61%)
How to sort all the lines by the order of date with format day-month-year? (59%)
How to sort a list of email addresses by the order of the domain name? (57%)
How to sort the lines in a text files by the order of line length? (57%)
How to change all numbers in a text file to the comma separated numbers? (57%)
How to extract all numbers in a text file, and provide a summary of number at the end? (57%)
How to reverse the order of the first column in text file? (56%)

Check Demo of Text sort
Keywords:
how to sort numbers by  contains numbers  abs  contains number  functions  return  sort number  sort num  contains  sub  return tab  order number  functions replace  replace with return  replace return  sort by number  sort of text  with numbers