diff --git a/fpga/zsbl/splitfile.sh b/fpga/zsbl/splitfile.sh new file mode 100755 index 000000000..1e367c872 --- /dev/null +++ b/fpga/zsbl/splitfile.sh @@ -0,0 +1,18 @@ +# Acquired from here. +# https://stackoverflow.com/questions/3066948/how-to-file-split-at-a-line-number +file_name=$1 + +# set first K lines: +K=512 + +# line count (N): +N=$(wc -l < $file_name) + +# length of the bottom file: +L=$(( $N - $K )) + +# create the top of file: +head -n $K $file_name > boot.mem + +# create bottom of file: +tail -n $L $file_name > data.mem