0

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

1 Answer 1

2

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
1
  • I will try your solutions, right now I am updating the question with more details. Sep 30, 2012 at 11:09

Not the answer you're looking for? Browse other questions tagged .