Is there a standard Linux command i can use to read a file chunk by chunk? For example, i have a file whose size is 6kB. I want to read/print the first 1kB, and then the 2nd 1kB ... Seems cat/head/tail wont work in this case.
Thanks very much.
Is there a standard Linux command i can use to read a file chunk by chunk? For example, i have a file whose size is 6kB. I want to read/print the first 1kB, and then the 2nd 1kB ... Seems cat/head/tail wont work in this case.
Thanks very much.
You could do this with
read -n
in a loop:split
can split a file into pieces by given byte countyou can use
fmt
eg 10bytes
each line is 10 characters. If you want to read the 2nd chunk, pass it to tools like awk ..eg
To save each chunk to file, (or you can use
split
with -b )dd will do it
And then skip=1 for the second chunk, and so on.
You then just need to read the output_tmp_file to get the chunk.
Are you trying to actually read a text file? Like with your eyes? Try
less
ormore