Answers:
如果您使用的是Windows 10,则可以使用 Ubuntu-Bash cmd 否则你可能想用 Unix的GNU-utils的换视窗
一旦你安装它,你将能够使用unix head 和 tail 命令,并将输出重定向到新文件
head -100 (或任意数量的行)
tail -100 (或任意数量的行)
为了获得文件中的行数,您可以使用Unix wc -l 命令
wc -l filename.txt
获得此文件中的行数后,您可以使用5/100将该数字加倍,以获得5%的数量,并将此结果用于 head 要么 tail 命令
例如
head -100000 file1 > file2
head - output the first part of files -n, --lines=[-]K print the first K lines instead of the first 10; with the leading '-', print all but the last K lines of each file
tail - output the last part of files -n, --lines=K output the last K lines, instead of the last 10; or use -n +K to output lines starting with the Kth
wc - print newline, word, and byte counts for each file -l, --lines print the newline counts
wc -l 获取巨大文件的长度,并使用num-of-lines *(5/100)计算百分比