Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to find an Android shell command that is able to read a file but that has the power to skip, for example 512 bytes every 1024 bytes.

Does such a command exist and is available for Android devices?

I have looked at dd documentation but couldn't figure out if it is possible to use dd for that purpose. You make dd skip bytes at the beginning of the file, you can make it read X bytes from a file, but I do not see how to get that feature that I described.

EDIT:

For my purpose the command/script should output to stdout, and the processing will read the output like a stream, so it will not be something like "cat a file, do processing, cat a file". It is like "while true; do cat a file; done | processing".

The list of available commands is here: http://www.busybox.net/downloads/BusyBox.html

share|improve this question
add comment

closed as off topic by MaQleod, Diogo, 8088, ChrisF, slhck Oct 3 '12 at 10:19

Questions on Super User are expected to relate to computer software or computer hardware within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

Hmm, this is interesting. Something like this might possibly be doable, but I haven't managed to get it to work exactly like this.

while head -c 1536; do
    head -c 1024
    dostuff
done

cat file | superawesomescript

This seems more definitive to me, but I haven't tested it:

script:

mkfifo fifo
while dd bs=1b count=1536 of=fifo; do
    head -c 1024 fifo | processing
done
unlink fifo
share|improve this answer
    
I will try your solutions, right now I am updating the question with more details. –  Rui Marques Sep 30 '12 at 11:09
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.