@
区切り文字として使用する4列のCSVファイルがあります。例:
0001 @ fish @ animal @ eats worms
最初の列は、一意であることが保証されている唯一の列です。
列2、3、および4で4つのソート操作を実行する必要があります。
まず、列2が英数字でソートされます。この種の重要な機能は、列2内の重複するエントリが互いに隣接していることを保証する必要があることです。例:
@ a @ @
@ a @ @
@ a @ @
@ a @ @
@ a @ @
@ b @ @
@ b @ @
@ c @ @
@ c @ @
@ c @ @
@ c @ @
@ c @ @
次に、最初の並べ替えで、行を2つのカテゴリに並べ替えます。最初の行は、「arch。」、「var。」、「ver。」、「anci」という単語を含まない行です。または「fam」。列4内の任意の場所。2行目(後にソートされます)は、これらの単語を含む行です。例:
@ a @ @ Does not have one of those words.
@ a @ @ Does not have one of those words.
@ a @ @ Does not have one of those words.
@ a @ @ Does not have one of those words.
@ a @ @ This sentence contains arch.
@ b @ @ Does not have one of those words.
@ b @ @ Has the word ver.
@ c @ @ Does not have one of those words.
@ c @ @ Does not have one of those words.
@ c @ @ Does not have one of those words.
@ c @ @ This sentence contains var.
@ c @ @ This sentence contains fam.
@ c @ @ This sentence contains fam.
最後に、2番目の並べ替えの個別のカテゴリ内でのみ並べ替え、「列3内に重複するエントリが最も多い」から「列3内に重複するエントリが最も少ない」までの行を並べ替えます。例:
@ a @ fish @ Does not have one of those words.
@ a @ fish @ Does not have one of those words.
@ a @ fish @ Does not have one of those words.
@ a @ tiger @ Does not have one of those words.
@ a @ bear @ This sentence contains arch.
@ b @ fish @ Does not have one of those words.
@ b @ fish @ Has the word ver.
@ c @ bear @ Does not have one of those words.
@ c @ bear @ Does not have one of those words.
@ c @ fish @ Does not have one of those words.
@ c @ tiger @ This sentence contains var.
@ c @ tiger @ This sentence contains fam.
@ c @ bear @ This sentence contains fam.
ファイルを2列目、4列目でのキーワードの出現、3列目で最も一般的な重複から最も一般的でない重複で英数字で並べ替えるにはどうすればよいですか?