![]() |
![]() |
#1 | ||
Dec 2011
After milion nines:)
155810 Posts |
![]()
I try for hours and try countless options / combinations but never got 100% what I need ( and ask for help here)
Using sort command under win So input file is (fake data) Quote:
Quote:
|
||
![]() |
![]() |
![]() |
#2 |
Mar 2006
Germany
3×23×43 Posts |
![]()
Try this:
- your factors file is "test.txt" - create awk file "listsort.awk" with code Code:
{ gsub(/*2\^/," ",$3) gsub(/+1/,"",$3) gsub(/-1/,"",$3) printf "%20s | %9s %15s\n",$1,substr($3,1,index($3," ")-1),substr($3,index($3," ")+1) >>"test.res" } Code:
gawk -f listsort.awk test.txt sort /+23 test.res >test.srt del test.res >nul Code:
101755669569157 | 111 479221 100210790671219 | 111 483289 102599598829447 | 222 66533 10133084529481 | 333 546934 100156363476569 | 555 721991 102765600059849 | 555 1040951 |
![]() |
![]() |
![]() |
#3 |
Aug 2002
100001001001012 Posts |
![]()
You don't want to hear this, but this is why we use Linux.
Code:
$ cat file 100156363476569 | 555*2^721991+1 100210790671219 | 111*2^483289+1 10133084529481 | 333*2^546934+1 101755669569157 | 111*2^479221+1 102599598829447 | 222*2^66533+1 102765600059849 | 555*2^1040951+1 $ cat file | sort -t "^" -k2,2n | sort -t "|" -k2,2n -s 101755669569157 | 111*2^479221+1 100210790671219 | 111*2^483289+1 102599598829447 | 222*2^66533+1 10133084529481 | 333*2^546934+1 100156363476569 | 555*2^721991+1 102765600059849 | 555*2^1040951+1 ![]() |
![]() |
![]() |
![]() |
#4 |
"Rashid Naimi"
Oct 2015
Remote to Here/There
2·11·103 Posts |
![]()
In windows, I would import the text file into excel as delimited text:
Excel >> Data >> From Text >> use appropriate delimited separator say "space" >> sort on the desired column, say the exponent >> Copy-All & Paste into a text file If it was worth wasting time programming for, I would use javascript. Runs fine on windows. Just my 2 cents. |
![]() |
![]() |
![]() |
#5 |
"Oliver"
Sep 2017
Porta Westfalica, DE
2×3×181 Posts |
![]()
Pepi, would you be willingly to use WSL or MSYS under Windows? Then you can use the suggested Linux solutions.
|
![]() |
![]() |
![]() |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Export team standings | ChristianV | Programming | 3 | 2018-12-27 22:13 |
Sorting on chinese remainder theorem | alpertron | Math | 23 | 2017-12-15 16:46 |
Failed to Load GPU Sorting Engine (sort_engine_sm20.dll) | GodyDeeps | Msieve | 5 | 2015-01-03 17:23 |
Card Sorting Probability | Mini-Geek | Math | 13 | 2007-01-13 15:31 |
Sorting Files into 'chunks' of size X | antiroach | Programming | 17 | 2004-03-01 01:15 |