fixed: make data conversion script more portable

should fix issues on osx
This commit is contained in:
Arne Morten Kvarving
2015-06-30 15:38:22 +02:00
parent af0c51e74f
commit 0834a1436e
+7 -6
View File
@@ -13,12 +13,13 @@
inputfile="$1"
outputfile="$2"
# 1. gzip output file
# 2. convert to hex
# 3. drop last line of output
# 4. print all but first parameter (offset) in C++ formatting
cat "$inputfile" | \
gzip -9 | \
od -v -t x1 | \
sed \
's/^[0-9A-Fa-f]\{1,\} *//
/^ *$/d
s/ \{1,\}/,0x/g
s/^/0x/
s/$/,/' > "$outputfile"
awk 'NR>1{print buf}{buf = $0}' | \
awk '{for (i=2; i<=NF; i++) print "0x"$i","}' > "$outputfile"