Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

420.Advanced search and replace -- How to convert numbers into scientific format with specified spacing?

User: Chris Sokolowski -- 2010-02-12          << 419  421 >>
Hits: 413
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
I need to take a document filled with floating point numbers, grouped into categories of three per line with spaces between them, divide them by 10^9 (i.e. 1000000000), and convert the numbers into scientific format (i.e. with exponents) with three spaces between each number. Thanks for the help in advance!
Input Sample:
2.20644 25.71760 35.70799
2.09604 26.11813 34.22509
1.07756 27.19535 33.80809
Output Sample:
0.220644D-10 0.2571760D-09 0.3570799D-09
0.209604D-10 0.2611813D-09 0.3422509D-09
0.107756D-10 0.2719535D-09 0.3380809D-09
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-o open your source text file
2. ctrl-h open 'replace' window
* set 'replace unit' to 'Chars'
* set 'replace scope' to 'Line'
* uncheck 'Print unmatch unit' option
* in 'search for pattern', enter:

* in 'replace with pattern', enter:

3. click 'Replace', done!
4. ctrl-s save to file.

Note:
sprintf("%e   %e   %e",$1/(10**8),$2/(10**8),$3/(10**8)) will generate output of standard scientific format like:

2.206440e-008   2.571760e-007   3.570799e-007

replace(sprintf(xxxx), '(\d)\.(\d+)e(.)0','0.$1$2D$3') will change the format to:

0.2206440D-08   0.2571760D-07   0.3570799D-07



Download Script:  scripts/420.rst.zip

Screenshot 1:  Replace_Window


Similar Examples:
How to convert the text format by user specified rules? (63%)
How to convert a text file to specified format? (57%)
How to convert the text from hex format to ascii format? (57%)
How to convert the decimal IP address into binary format with 0 and 1? (56%)
How to change text file format with user specified rules? (56%)
How to generate a list of number base on given formula such as 3n+1? (53%)
How to sort the text by the number of specific word in each line? (52%)
How to convert all numbers from decimal to percentage? (52%)

Check Demo of Advanced search and replace
Keywords:
float  divide  div  convert number  document  doc  ies  group  help  spaces  divide numbers  generate numbers  convert text to number  convert to number  specified format  search help  generate number  change the number for each