Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
awk を使用して、ファイルをランダムに 80/20 に分割したいと考えています。
私は、次のようなものが提案されているHEREにあるオプションを読んで試しました:
$ awk -v N=`cat FILE | wc -l` 'rand()<3000/N' FILE
ランダムな選択が必要な場合に最適です。
ただし、1 つのファイルを 80/20 (またはその他の) 比率の 2 つのファイルに分割するために、この awk を変更することは可能ですか?