How can I copy part of the huge file to new file?
If you have Windows 10, you can use Ubuntu-Bash cmd otherwise you might want to use Unix-GNU-Utils-for-Windows
Once you'll install it, you'll be able to use unix head
and tail
commands, and redirect the output into a new file
head -100
(or any number of lines)tail -100
(or any number of lines)
In order to get the amount of lines in the file, you can use Unix wc -l
command
wc -l filename.txt
After you get the number of lines in this file, you can multiple the number with 5/100 in order to get the amount of 5%, and use this result in the head
or tail
commands
e.g.
head -100000 file1 > file2
man head
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
man tail
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 man
wc - print newline, word, and byte counts for each file -l, --lines print the newline counts