# # Select only required types of participants from the 'Ucastnici.csv' # Generate sort code approximating Czech collating sequence # function rtrim(s1) {while (substr(s1,length(s1))==" ") s1=substr(s1,1,length(s1)-1); return s1} function sortkey(s1) { s2="" sk[1] = "a" sk[2] = "cz" sk[3] = "d" sk[4] = "e" sk[5] = "e" sk[6] = "i" sk[7] = "n" sk[8] = "o" sk[9] = "rz" sk[10] = "sz" sk[11] = "tz" sk[12] = "u" sk[13] = "u" sk[14] = "y" sk[15] = "zz" sk[16] = "a" sk[17] = "cz" sk[18] = "d" sk[19] = "e" sk[20] = "e" sk[21] = "i" sk[22] = "n" sk[23] = "o" sk[24] = "rz" sk[25] = "sz" sk[26] = "tz" sk[27] = "u" sk[28] = "u" sk[29] = "y" sk[30] = "zz" for (i=1; i<=length(s1); i++) { j = index("áèïéìíòóøšúùýžÁÈÏÉÉÍÒÓØŠÚÙÝŽ",substr(s1,i,1)) s = j > 0 ? sk[j] : substr(s1,i,1) s2 = s2 s } return s2 } # BEGIN { FS="|" # create backup copy while (getline < "ucas.htm" != 0) print $0 > "ucas.htm~" close "ucas.htm" close "ucas.htm~" # skip first line getline } (index(type,$14)) { print $1 "|" $2 "|" $3 "|" $4 "|" $5 "|" $6 "|" $7 "|" $8 "|" $9 "|" $10 "|" $11 "|" $12 "|" $13 "|" $14 "|" sortkey(rtrim($2)) "|" sortkey(rtrim($3)) }