Maybe I'm overthinking this (although I don't think I am)....or maybe there's a neater way of solving my problem ?I have a requirement that if a file is larger than 1GB, it gets split into smaller chunks for processing.No problem so far, that can easily be achieved with dd.The problem is what happens with files larger than 4GB ?My thinking at the moment is to start along the following lines ...# Determine if file needs to be splitdetermineSplit() {    typeset FILE_SIZE=$(ls -l ${1} | awk '{print $5}');    typeset -F NUMBER_OF_GIGS=$(print ${FILE_SIZE}/${BK_ONEGIG}|bc) # using bc for >4GB    if (( ${NUMBER_OF_GIGS} >= 1 )); then        return 0    else        return 1    fi}Then once the need to split is determined, I know I need to call dd in a loop... but the problem is, what do I do about calculating seek points for dd if I can't use 64 bit integers in ksh conditional statements ?I'm all confused !Edit to clarify :  (1) I'm hoping to make a reasonably portable script, so preferably no GNU-only answers (2) No, split won't work for reasons outlined in my comment below ;-)
Help with 64-bit integers in scripts?
shell;shell script;ksh
You should look up split; it may do what you want. (Also, as @Marco notes in his comment, don't parse ls output; consider using stat -f '%s' instead) If not:You shouldn't need to calculate seek points, let the file descriptor do that for you. This is bash syntax:for ((i = 0; i < n_blocks; ++i); do    dd bs=4k count=262144done < input-file-nameThe key point being leave the input file open as dd's stdin, then each time dd reads from it, it'll continue where it left off.