mirror of
https://github.com/OPM/opm-upscaling.git
synced 2026-08-26 13:07:11 -05:00
fixed: make data conversion script more portable
should fix issues on osx
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user