实用 shell
文本处理 清除每行头&尾部的空白符 awk '{$1=$1;print}' ref: https://stackoverflow.com/questions/448005/whats-an-easy-way-to-read-random-line-from-a-file 在一个文本随机选取若干行 // macos 则先 brew install coreutils,然后用 gshuf shuf foo.txt | head -n 100 cat foo.txt | awk 'BEGIN{srand();}{print rand()"\t"$0}' | sort -k1 -n | cut -f2- | head -n 100 ref: https://stackoverflow.com/questions/448005/whats-an-easy-way-to-read-random-line-from-a-file 截取每行的前几个字符 cut -c 1-3 file // 前三个字符 ref: https://stackoverflow.com/questions/19869511/how-to-restrict-length-of-string-present-in-a-line-using-linux