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: 292
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 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 count the number of occurrence of every double letters? (56%)
How to count the number of english words that has specified number of chars? (56%)

Check Demo of Text sort
Keywords:
how to sort numbers by  abs  functions  return  sort number  sub  order  text sort  function  beginning  order number  functions replace  sort by number  text to numbers  sort file  with number  file number  replace from file