Author Topic: Data sorting problem  (Read 5985 times)

Offline LANS

  • GB Member
  • Make me commander
  • ******
  • Posts: 685
  • flying with a calculator
Data sorting problem
« on: February 07, 2011, 09:20:36 PM »
http://dl.dropbox.com/u/153439/BitList.txt

I need to pull out all the numbers from that file which are prefixed with b or !b, then sort them in ascending order and delete all the duplicates.
Ideas?

I already tried this (in Bash shell, Linux):

Code: [Select]
sed 's/.*b\([0-9]\+\).*/\1/' ./BitList.txt | sort -un
But it didn't work.

Offline skutch

  • GB Member
  • intwhore
  • ****
  • Posts: 321
  • City: A place where people can be lonely together
Re: Data sorting problem
« Reply #1 on: February 08, 2011, 08:29:50 AM »
When I still was apt at C programming (lie 15 years ago) I would have made a sorting program in C.  Now, I cant access that data from work (oh no, I'm using my coffe brake to post stuff on forums) but excel spread sheets got a pretty good sorting support if it fits.

Offline Zruty

  • GB Member
  • scoutwhore
  • *****
  • Posts: 441
Re: Data sorting problem
« Reply #2 on: February 08, 2011, 10:59:11 AM »
lexicographically ascending, or numerically ascending?

That is, is b5 > b102 or b5 < b102 ?

Offline Zruty

  • GB Member
  • scoutwhore
  • *****
  • Posts: 441
Re: Data sorting problem
« Reply #3 on: February 08, 2011, 11:11:44 AM »
Code: [Select]
0 9 18 27 36 45 47 53 62 71 80 82 90 92 101 112 121 123 134 143 145 147 149 151 187 221 227 298 308 310 315 669 901 1210 1219 1228 1237 1246 1250 1281 1307 1340 1373 1420 1842 2256 2260 2266 2270 2274 2278 2284 2288 2292 2296 2300 2302 2304 2308 2310 2322 2324 2326 2328 2329 2331 2333 2789 2793 2865 2933 2973 2992 2996 3000 3004 3014 3022 3039 3047 3063 3067 3071 3093 3097 3099 3101 3103 3113 3119 3122 3124 3129 3137 3148 3160 3163 3164 3166 3168 3173 3175 3178 3182 3185 3188 3191 3194 3198 3208 3213 3215 3228 3241 3254 3260 3317 3374 3431 3456 3492 3505 3515 3519 3523 3527 3531 3535 3539 3628 3636 3644 3652 3662 3665 3668 3671 3674 3677 3680 3686 3689 5774 5868 5872 5874 5876 5878 5880 5884 5886 5888 5890 5892 5896 5900 5904 5908 5912 5916 5920 5924 5928 5932 5936 5940 5944 5948 5952 5958 5964 5970 5976 5982 5988 5994 6000 6006 6018 6025 6031 6037 6061 6067 6073 6079 6085 6091 6097 6103 6109 6115 6121 6127 6133 6139 6145 6151 6157 6163 6169 6175 6181 6187 6193 6199 6205 6211 6217 6223 6229 6235 6241 6247 6253 6259 6265 6271 6277 6283 6289 6295 6301 6307 6313 6319 6325 6477 6483 6489 6495 6501 6507 6513 6519 6529 6535 6541 6547 6553 6559 6565 6571 6577 6583 6589 6595 6601 6607 6613 6619 6625 6631 6637 6643 6649 6655 6661 6667 6673 6679 6685 6691 6703 6707 6711 6715 6721 6727 6733 6754 6771 6774 6777 6781 6785 6789
Here's the c# code I used: http://pastebin.com/um9mZZBi

Offline LANS

  • GB Member
  • Make me commander
  • ******
  • Posts: 685
  • flying with a calculator
Re: Data sorting problem
« Reply #4 on: February 08, 2011, 04:16:48 PM »
Thanks a ton zruty.

Offline lexaal

  • GB Member
  • Make me commander
  • ******
  • Posts: 790
  • We can't bomb here! This is bat country.
    • We can't bomb here! This is bat country.
Re: Data sorting problem
« Reply #5 on: February 08, 2011, 07:25:45 PM »
in my favourite programming language (sadly i haven't got it installed): matlab code
Quote
A=sort(unique(fscanf(fopen('bitlist.txt'),'b%d',inf)))
No point in mentioning these bats, I thought. Poor bastard will see them soon enough.