1#!/bin/sh - 2# $OpenBSD: stests,v 1.2 2001/02/04 21:29:31 ericj Exp $ 3# from: @(#)stests 8.1 (Berkeley) 6/6/93 4 5#Latest version. My sort passes all tests because I wrote it. 6#We differ only on 25E and 25H. 7#(I found at least one bug in constructing test 25, and was driven 8#to rewrite field parsing to clarify it.) 9# 10#In 25E, -k2.3,2.1b, the fields are not necessarily out of order. 11#Even if they were, it would be legal (11752-3), although certainly 12#justification for warning. 13# 14#On 25H, your answer is as defensible as mine. (Our suggestion 15#*1 backs mine.) 16 17 18# Tests for the Unix sort utility 19# Test Posix features except for locale. 20# Test some nonstandard features if present. 21 22# Other tests should be made for files too big to fit in memory. 23 24 25# Initialize switches for nonstandard features. 26# Use parenthesized settings for supported features. 27 28o=: # officially obsolescent features: +1 -2, misplaced -o (o=) 29g=: # -g numeric sort including e-format numbers (g=) 30M=: # -M sort by month names (M=) 31s=: # -s stable, do not compare raw bytes on equal keys (s=) 32y= # -y user-specified memory size (y=-y10000) 33 34# Detect what features are supported, assuming bad options cause 35# errors. Set switches accordingly. 36 37echo obsolescent and nonstandard features recognized, if any: 38if sort +0 </dev/null 2>/dev/null; then o= 39 echo ' +1 -2'; fi 40if sort /dev/null -o xx 2>/dev/null; then o= 41 echo ' displaced -o'; fi 42if sort -g </dev/null 2>/dev/null; then g= 43 echo ' -g g-format numbers'; fi 44if sort -M </dev/null 2>/dev/null; then M= 45 echo ' -M months'; fi 46if sort -s </dev/null 2>/dev/null; then s= 47 echo ' -s stable'; fi 48if sort -y10000 </dev/null 2>/dev/null; then y=-y10000 49 echo ' -y space'; fi 50if sort -z10000 </dev/null 2>/dev/null; then 51 echo ' -z size (not exercised)'; fi 52if sort -T. </dev/null 2>/dev/null; then 53 echo ' -T tempdir (not exercised)'; fi 54 55 56export TEST # major sequence number of test 57 58trap "rm -f in in1 out xx -k xsort linecount fields; exit" 0 1 2 13 15 59 60# xsort testno options 61# Sort file "in" with specified options. 62# Compare with file "out" if that is supplied, 63# otherwise make plausibility checks on output 64 65# "sum" must be dumb; insensitive to the 66# order of lines within a file. 67# System V sum is suitable; sum -5 is the v10 equivalent. 68 69PATH=.:$PATH 70export PATH 71cat <<'!' >xsort; chmod +x xsort 72 73 X=$1; shift 74 75 if sort "$@" in >xx && sort -c "$@" xx 76 then 77 if test -f out 78 then 79 cmp xx out >/dev/null && exit 0 80 echo $TEST$X comparison failed 81 else 82 test "`cksum -o2 <in`" = "`cksum -o2 <xx`" && exit 0 83 echo $TEST$X checksum failed 84 fi 85 else 86 echo $TEST$X failed 87 fi 88 exit 1 89! 90 91# linecount testno file count 92# declares the given "testno" to be in error if number of 93# lines in "file" differs from "count" 94 95cat <<'!' >linecount; chmod +x linecount 96awk 'END{ if(NR!='$3') print "'$TEST$1' failed" }' $2 97! 98 99rm -f out 100 101#--------------------------------------------------------------- 102TEST=01; echo $TEST # -c status, checksum 103 # obsolescent features go together 104cat <<! >in 105b 106a 107! 108rm -f out -o 109 110sort -c in 2>/dev/null && echo ${TEST}A failed 111 112xsort B || '"cksum"' is probably unsuitable - see comments 113 114$o sort +0 in -o in || echo ${TEST}c failed 115 116#--------------------------------------------------------------- 117TEST=02; echo $TEST # output from -c 118cat <<! >in 119x 120y 121! 122 123sort -cr in >out 2>xx && echo ${TEST}A failed 124test -s out && echo ${TEST}B failed 125test -s xx && echo option -c is noisy "(probably legal)" 126test -s xx || echo option -c is quiet "(legal, not classical)" 127 128#--------------------------------------------------------------- 129TEST=03; echo $TEST # -n 130cat <<! >in 131-99.0 132-99.1 133-.0002 134-10 1352 1360010.000000000000000000000000000000000001 13710 1383x 139x 140! 141cat <<! >out 142-99.1 143-99.0 144-10 145-.0002 146x 1472 1483x 14910 1500010.000000000000000000000000000000000001 151! 152 153xsort "" -n 154 155#--------------------------------------------------------------- 156TEST=04; echo $TEST # -b without fields, piping, -c status return 157cat <<! >in 158 b 159 a 160! 161cp in out 162 163xsort A -b 164 165cat in | sort | cat >xx 166cmp xx out >/dev/null || echo ${TEST}B failed 167 168sort in | sort -cr 2>/dev/null && echo ${TEST}C failed 169 170#--------------------------------------------------------------- 171TEST=05; echo $TEST # fields, reverse fields, -c status return 172cat <<! >in 173b b p 174a b q 175x a 176! 177cat <<! >out 178x a 179a b q 180b b p 181! 182 183$o xsort A +1 -2 184 185$o xsort B +1 -2 +2r 186 187xsort C -k 2,2 188 189xsort D -k 2,2 -k 3r 190 191xsort E -k 2,2.0 192 193xsort F -k 2,2 -k 1,1 -k 3 194 195sort -c -k 2 in 2>/dev/null && echo ${TEST}G failed 196 197#--------------------------------------------------------------- 198TEST=06; echo $TEST # -t 199cat <<! >in 200a: 201a! 202! 203cp in out 204 205$o xsort A -t : -r +0 206 207$o xsort B -t : +0 -1 208 209xsort C -t : -r -k 1 210 211xsort D -t : -k 1,1 212 213#--------------------------------------------------------------- 214TEST=07; echo $TEST # -t, character positions in fields 215 # -t: as 1 arg is not strictly conforming, but classical 216cat <<! >in 217: ab 218:bac 219! 220cat <<! >out 221:bac 222: ab 223! 224 225$o xsort A -b -t: +1.1 226 227$o xsort B -t: +1.1r 228 229xsort C -b -t: -k 2.2 230 231xsort D -t: -k 2.2r 232 233#--------------------------------------------------------------- 234TEST=08; echo $TEST # space and tab as -t characters 235cat <<! >in 236 b c 237 b c 238 b c 239! 240cp in out 241 242xsort A -t ' ' -k2,2 243 244xsort B -t ' ' -k2.1,2.0 245 246cat <<! >out 247 b c 248 b c 249 b c 250! 251 252xsort C -t ' ' -k2,2 253 254xsort D -t ' ' -k2.1,2.0 255 256cat <<! >out 257 b c 258 b c 259 b c 260! 261 262xsort E -k2 263 264cat <<! >out 265 b c 266 b c 267 b c 268! 269 270xsort F -k2b 271 272#--------------------------------------------------------------- 273TEST=09; echo $TEST # alphabetic as -t character 274cat <<! >in 275zXa 276yXa 277zXb 278! 279cp in out 280 281xsort "" -tX -k2 -k1r,1 282 283#--------------------------------------------------------------- 284TEST=10; echo $TEST # -m 285cat <<! >in 286a 287ab 288ab 289bc 290ca 291! 292cat <<! >in1 293Z 294a 295aa 296ac 297c 298! 299cat <<! >out 300Z 301a 302a 303aa 304ab 305ab 306ac 307bc 308c 309ca 310! 311 312sort -m in in1 >xx 313cmp xx out >/dev/null || echo $TEST failed 314 315#--------------------------------------------------------------- 316TEST=11; echo $TEST # multiple files, -o overwites input, -m, -mu 317cat <<! >in 318a 319b 320c 321d 322! 323 324sort -o xx in in in in in in in in in in in in in in in in in 325linecount A xx 68 326sort -o in -mu in in in in in in in in in in in in in in in in in 327linecount B in 4 328sort -o in -m in in in in in in in in in in in in in in in in in 329 330cmp in xx >/dev/null || echo ${TEST}C failed 331 332#--------------------------------------------------------------- 333TEST=12; echo $TEST # does -mu pick the first among equals? 334cat <<! >in 3353B 3363b 3373B2 338~3B2 3394.1 34041 3415 3425. 343! 344cat <<! >out 3453B 3463B2 3474.1 3485 349! 350 351xsort A -mudf || echo "(other behavior is legal, not classical)" 352 353xsort B -mudf -k1 || echo "(other behavior is legal, not classical)" 354 355#--------------------------------------------------------------- 356TEST=13; echo $TEST # long records (>8000 bytes, keys >16000), -r 357awk ' 358BEGIN { x="x" 359 for(i=1; i<=12; i++) x = x x 360 for(i=15; i<=25; i++) print x i 361}' >in 362awk ' 363BEGIN { x="x" 364 for(i=1; i<=12; i++) x = x x 365 for(i=25; i>=15; i--) print x i 366}' >out 367 368xsort A -r 369 370xsort B -k 1,1r -k 1 371 372#--------------------------------------------------------------- 373TEST=14; echo $TEST "(3 long parts)" 374awk 'BEGIN { for(i=0; i<100000; i++) print rand() }' | grep -v e >in 375rm -f out 376 377xsort A; echo $TEST "(part A done)" 378 379xsort B -n; echo $TEST "(part B done)" 380 381# next test is unclean: xx is a hidden side-effect of xsort 382 383awk ' 384 $0 < x { print "test '${TEST}C' failed"; exit } 385 $0 "" != x { print >"out"; x = $0 } 386' xx 387 388xsort C -n -u 389 390#--------------------------------------------------------------- 391TEST=15; echo $TEST "(long)" # force intermediate files if possible 392awk 'BEGIN { for(i=0; i<20000; i++) print rand() }' >in 393rm -f out 394 395xsort A -r $y 396 397sort -r in | awk '$0 "x" != x { print ; x = $0 "x" }' >out 398 399xsort B -u -r $y 400 401#--------------------------------------------------------------- 402TEST=16; echo $TEST # -nr, -nm, file name - 403awk 'BEGIN { for(i=-100; i<=100; i+=2) printf "%.10d\n", i }' >in 404 405awk 'BEGIN { for(i=-99; i<=100; i+=2) print i }' | sort -nr in - >xx 406awk '$0+0 != 101-NR { print "'${TEST}A' failed"; exit }' xx 407 408awk 'BEGIN { for(i=-99; i<=100; i+=2) print i }' | sort -mn in - >xx 409awk '$0+0 != -101+NR { print "'${TEST}B' failed"; exit }' xx 410 411#--------------------------------------------------------------- 412TEST=17; echo $TEST # -d, fields without end, modifier override 413cat <<! >in 414a-B 415a+b 416a b 417A+b 418a b 419! 420cat <<! >out 421a b 422a b 423A+b 424a-B 425a+b 426! 427 428$o xsort A -df +0 +0d 429 430xsort B -df -k 1 -k 1d 431 432#--------------------------------------------------------------- 433TEST=18; echo $TEST # -u on key only 434cat <<! >in 43512 y 43613 z 43712 x 438! 439cat <<! >out 44012 x 44112 y 44213 z 443! 444 445$o xsort A +0 -1 446 447xsort B -k 1,1 448 449sort -u -k 1,1 in >xx 450linecount C xx 2 451 452#--------------------------------------------------------------- 453TEST=19; echo $TEST # -i, -d, -f 454cat <<! >xx.c 455run(i,j){ for( ; i<=j; i++) printf("%.3o %c\n",i,i); } 456main(){ run(0, 011); /* 012=='\n' */ 457 run(013, 0377); } 458! 459cc xx.c 460a.out >in 461cat <<! >xx.c 462run(i,j){ for( ; i<=j; i++) printf("%.3o %c\n",i,i); } 463main(){ run(0, 011); 464 run(013, ' '-1); 465 run(0177, 0377); 466 run(' ', 0176); } 467! 468cc xx.c 469a.out >out 470 471xsort A -i -k 2 472 473cat <<! >xx.c 474run(i,j){ for( ; i<=j; i++) printf("%.3o %c\n",i,i); } 475main(){ run(0, 010); /* 011=='\t', 012=='\n' */ 476 run(013, ' '-1); 477 run(' '+1, '0'-1); 478 run('9'+1, 'A'-1); 479 run('Z'+1, 'a'-1); 480 run('z'+1, 0377); 481 run('\t', '\t'); 482 run(' ', ' '); 483 run('0', '9'); 484 run('A', 'Z'); 485 run('a', 'z'); } 486! 487cc xx.c 488a.out >out 489 490xsort B -d -k 2 491 492cat <<! >xx.c 493run(i,j){ for( ; i<=j; i++) printf("%.3o %c\n",i,i); } 494main(){ int i; 495 run(0, 011); 496 run(013, 'A'-1); 497 for(i='A'; i<='Z'; i++) 498 printf("%.3o %c\n%.3o %c\n",i,i,i+040,i+040); 499 run('Z'+1, 'a'-1); 500 run('z'+1, 0377); } 501! 502cc xx.c 503a.out >out 504rm xx.c 505 506xsort C -f -k 2 507 508#--------------------------------------------------------------- 509TEST=20; echo $TEST # -d, -f, -b applies only to fields 510cat <<! >in 511 b 512'C 513a 514! 515cp in out 516 517xsort A -d 518 519xsort B -f 520 521cat <<! >out 522 b 523a 524'C 525! 526 527xsort C -dfb 528 529#--------------------------------------------------------------- 530TEST=21; echo $TEST # behavior of null bytes 531cat <<'!' >xx.c 532main() { printf("%cb\n%ca\n",0,0); } 533! 534cc xx.c 535a.out >in 536sort in >xx 537cmp in xx >/dev/null && echo ${TEST}A failed 538test "`wc -c <in`" = "`wc -c <xx`" || echo ${TEST}B failed 539rm xx.c a.out 540 541#--------------------------------------------------------------- 542TEST=22; echo $TEST # field limits 543cat <<! >in 544a 2 545a 1 546b 2 547b 1 548! 549cat <<! >out 550b 1 551b 2 552a 1 553a 2 554! 555 556xsort "" -r -k1,1 -k2n 557 558#--------------------------------------------------------------- 559TEST=23; echo $TEST # empty file 560 561sort -o xx </dev/null 562cmp xx /dev/null 2>/dev/null || echo ${TEST}A failed 563 564sort -c </dev/null || echo ${TEST}B failed 565 566sort -cu </dev/null || echo ${TEST}C failed 567 568#--------------------------------------------------------------- 569TEST=24; echo $TEST # many fields 570cat <<! >in 5710:2:3:4:5:6:7:8:9 5721:1:3:4:5:6:7:8:9 5731:2:2:4:5:6:7:8:9 5741:2:3:3:5:6:7:8:9 5751:2:3:4:4:6:7:8:9 5761:2:3:4:5:5:7:8:9 5771:2:3:4:5:6:6:8:9 5781:2:3:4:5:6:7:7:9 5791:2:3:4:5:6:7:8:8 580! 581cat <<! >out 5821:2:3:4:5:6:7:8:8 5831:2:3:4:5:6:7:7:9 5841:2:3:4:5:6:6:8:9 5851:2:3:4:5:5:7:8:9 5861:2:3:4:4:6:7:8:9 5871:2:3:3:5:6:7:8:9 5881:2:2:4:5:6:7:8:9 5891:1:3:4:5:6:7:8:9 5900:2:3:4:5:6:7:8:9 591! 592 593xsort "" -t: -k9 -k8 -k7 -k6 -k5 -k4 -k3 -k2 -k1 594 595#--------------------------------------------------------------- 596TEST=25; echo $TEST # variously specified alpha fields 597 # numbers give the correct orderings 598cat <<! >in 59901:04:19:01:16:01:21:01 a 60002:03:13:15:13:19:15:02 a 60103:02:07:09:07:13:09:03 a 60204:01:01:03:01:07:03:04 a 60305:08:20:16:17:02:20:05 aa 60406:07:14:18:14:20:14:06 aa 60507:06:08:10:08:14:08:07 aa 60608:05:02:04:02:08:02:08 aa 60709:16:22:02:22:04:24:13 b 60810:15:16:20:19:22:18:14 b 60911:14:10:12:10:16:12:15 b 61012:13:04:06:04:10:06:16 b 61113:24:24:22:24:06:22:21 bb 61214:23:18:24:21:24:16:22 bb 61315:22:12:14:12:18:10:23 bb 61416:21:06:08:06:12:04:24 bb 61517:12:21:21:18:03:19:09 ab 61618:11:15:19:15:21:13:10 ab 61719:10:09:11:09:15:07:11 ab 61820:09:03:05:03:09:01:12 ab 61921:20:23:17:23:05:23:17 ba 62022:19:17:23:20:23:17:18 ba 62123:18:11:13:11:17:11:19 ba 62224:17:05:07:05:11:05:20 ba 623! 624sort -k2b -k2 in >xx && 625 sort -c -t: -k2n xx 2>/dev/null || echo ${TEST}A failed 626sort -k2,2.1b -k2 in >xx && 627 sort -c -t: -k3n xx 2>/dev/null || echo ${TEST}B failed 628sort -k2.3 -k2 in >xx && 629 sort -c -t: -k4n xx 2>/dev/null || echo ${TEST}C failed 630sort -k2b,2.3 -k2 in >xx && 631 sort -c -t: -k5n xx 2>/dev/null || echo ${TEST}D failed 632sort -k2.3,2.1b -k2 in >xx && 633 sort -c -t: -k6n xx 2>/dev/null || echo ${TEST}E failed 634sort -k2,2.1b -k2r in >xx && 635 sort -c -t: -k7n xx 2>/dev/null || echo ${TEST}F failed 636sort -b -k2,2 -k2 in >xx && 637 sort -c -t: -k8n xx 2>/dev/null || echo ${TEST}G failed 638sort -b -k2,2b -k2 in >xx && # perhaps same as G 639 sort -c -t: -k3n xx 2>/dev/null || echo ${TEST}H failed\ 640 "(standard is not clear on this)" 641 642#--------------------------------------------------------------- 643TEST=26; echo $TEST # empty fields, out of bounds fields 644cat <<! >in 6450 5 6461 4 6472 3 6483 2 6494 1 6505 0 651! 652cp in out 653 654xsort "" -k2.2,2.1 -k2.3,2.4 655 656#--------------------------------------------------------------- 657TEST=27; echo $TEST # displaced -o 658rm -f out 659 660$o sort /dev/null -o out || $o echo ${TEST}B failed 661$o test -f out || $o echo ${TEST}C failed 662 663#--------------------------------------------------------------- 664TEST=28; echo $TEST # apparently nonmonotone field specs 665cat <<! >in 666aaaa c 667x a 6680 b 669! 670cp in out 671 672$o xsort A +1 -0.3 +1.4 -1.5 673 674xsort B -k2,1.3 -k2.5,2.5 675 676#--------------------------------------------------------------- 677TEST=29; echo $TEST # determination of end of option list 678cat >-k <<! 679x 680! 681rm -f out -c 682 683sort -- -k </dev/null >xx || echo ${TEST}A argument failed 684cmp xx -k || echo ${TEST}A comparison failed 685 686sort - -c </dev/null 2>/dev/null && echo ${TEST}B failed 687 688#--------------------------------------------------------------- 689TEST=30; echo $TEST # missing newline 690awk 'BEGIN{ printf "%s", "x"}' | sort >xx 691wc -c <xx | awk '$1!=2{ print "'${TEST}' failed" }' 692 693#--------------------------------------------------------------- 694TEST=31; echo $TEST # -M, multiple fields 695cat <<! >in 696jan 10 1900 697Feb 26 1900 698feb 25 1900 699January xx 1900 700August 11 1900 701jan 15 1990 702feb 22 1990 703mar 15 1990 704apr 1 1990 705may 45 1990 706jun 14 1990 707jul 4 1990 708aug 1~ 1990 709aug 11 1990 710sep 1 1990 711oct 12 1990 712nov 24 1990 713dec 25 1990 714never 3 1990 715 Dec 25 1990 716! 717cat <<! >out 718January xx 1900 719jan 10 1900 720feb 25 1900 721Feb 26 1900 722August 11 1900 723never 3 1990 724jan 15 1990 725feb 22 1990 726mar 15 1990 727apr 1 1990 728may 45 1990 729jun 14 1990 730jul 4 1990 731aug 1~ 1990 732aug 11 1990 733sep 1 1990 734oct 12 1990 735nov 24 1990 736 Dec 25 1990 737dec 25 1990 738! 739 740$M xsort "" -k3n -k1M -k2n 741 742#--------------------------------------------------------------- 743TEST=32; echo $TEST # -M case insensitivity, -r 744cat <<! >in 745x 746june 747january 748december 749! 750cat <<! >out 751december 752june 753january 754x 755! 756 757$M xsort "" -Mr 758 759#--------------------------------------------------------------- 760TEST=33; echo $TEST # -g 761cat <<! >in 7622 7631 76410 765.2 7661e 7671E1 7681e. 769! 770cat <<! >out 771.2 7721 7731e 7741e. 7752 77610 7771E1 778! 779 780$g xsort "" -g 781 782#--------------------------------------------------------------- 783TEST=34; echo $TEST # -g wide operands 784cat <<! >in 785.99999999999999999999 786099999999999999999999e-21 787099999999999999999999e-19 788.1e1 789! 790cat <<! >out 791099999999999999999999e-21 792.99999999999999999999 793.1e1 794099999999999999999999e-19 795! 796 797$g xsort A -g 798 799cat <<! >out 800.1e1 801.99999999999999999999 802099999999999999999999e-19 803099999999999999999999e-21 804! 805 806xsort B -n 807 808#--------------------------------------------------------------- 809TEST=35; echo $TEST #-g, -u with different fp reps 810cat <<! >in 811+0 812-0 8130.10 814+.1 815-.1 816-100e-3 817x 818! 819cat <<! >out 820-.1 821-100e-3 822+0 823-0 824x 825+.1 8260.10 827! 828 829$g xsort A -g 830 831$g sort -gu in >xx && $g sort -c -gu xx || echo ${TEST}B failed 832$g linecount C xx 3 833 834#--------------------------------------------------------------- 835TEST=36; echo $TEST # -s 836cat <<! >in 837a 2 838b 1 839c 2 840a 1 841b 2 842c 1 843! 844cat <<! >out 845a 2 846a 1 847b 1 848b 2 849c 2 850c 1 851! 852 853$s xsort "" -s -k1,1 854 855#--------------------------------------------------------------- 856TEST=37; echo $TEST # -s, multiple files 857cat <<! >in 858a 2 859c 2 860! 861cat <<! >in1 862a 1 863b 1 864c 1 865! 866cat <<! >out 867c 2 868b 1 869a 2 870! 871 872$s sort -smru -k1,1 in in in1 in1 >xx 873$s cmp xx out >/dev/null || echo $TEST failed 874 875#--------------------------------------------------------------- 876TEST=38; echo $TEST # -s 877$s awk ' 878 BEGIN { 879 for(i=1; i<50; i++) 880 for(j=1; j<=i; j++) { 881 print i, 2 >"in" 882 print i, 1 >"in1" 883 } 884 }' 885 886$s sort -m -s -k1,1n in in1 >out 887 888$s awk ' 889 func stop() { print "'$TEST' failed"; exit } 890 $1!=last1 { if(count!=last1 || $2!=2) stop(); 891 count = 0} 892 $1==last1 && $2!=last2 { if(count!=last1 || $2!=1) stop(); 893 count = 0 } 894 { count++; last1 = $1; last2 = $2 } 895 ' out 896 897#--------------------------------------------------------------- 898TEST=39; echo $TEST # sort already sorted dictionary 899 900dict=/usr/share/dict/words 901 902sort -f $dict > out 903 904cmp -s out $dict || echo $TEST failed - sort -f $dict 905 906#--------------------------------------------------------------- 907TEST=40; echo "$TEST (long)" # long lines test 908 909line1="abcdefghijklmnopqrstabcdefghijklmnopqrstabcdefghijklmnopqrstabcdefghij" 910line2="bcdefghijklmnopqrstabcdefghijklmnopqrstabcdefghijklmnopqrstabcdefghijk" 911 912rm -f in out 913 914# generate two out-of-order long lines (roughly 70 KB each), and try sort 915# them 916awk ' 917BEGIN { 918 line1 = "'"${line1}"'" 919 line2 = "'"${line2}"'" 920 for(i=0; i<10; i++) { 921 line1 = line1 line1 922 line2 = line2 line2 923 } 924 print line2 > "in" 925 print line1 > "in" 926 927 print line1 > "out" 928 print line2 > "out" 929}' 930 931xsort "A" 932 933# generate already sorted file using $dict, only append space and 934# long string to each line to make lines longer than usual 935# use only first 200 lines (sort file approx. 14MB) 936cat $dict | awk ' 937BEGIN { 938 line = "'"$line1"'" 939 for(i=0; i<10; i++) 940 line = line line 941 idx = 0 942} 943{ print $1 " " line; if (idx++ > 200) exit 0 }' > in 944ln -sf in out 945xsort "B" -f 946