Skip to content

Instantly share code, notes, and snippets.

@dbuse
Last active May 7, 2019 15:33
Show Gist options
  • Save dbuse/1343fce522fd49cdcceb37e6c77c47de to your computer and use it in GitHub Desktop.
Save dbuse/1343fce522fd49cdcceb37e6c77c47de to your computer and use it in GitHub Desktop.
Convert OMNeT++ .vec files into long-format (tidy) csv file
# Convert OMNeT++ .vec files into long-format (tidy) csv file
#
# The vector data first needs to be sorted by vector (first field) for join to work
%.vecdata: %.vec
grep -v '^vector\|attr\|version\|param\|run' $< | grep -v '^$$' | sort -k 1n > $@
%.vecmatch.join: %.vec
grep '^vector' $< | grep -v '^$$' | sed 's/vector\s\+\([0-9]\+\)\s\+\([^ \t]\+\)\s\+\([^ \t]\+\)\s\+[ETV]*/\1\t\2\t\3/' > $@
%.long.csv.gz: %.vecmatch.join %.vecdata
join -j1 $^ | gzip --fast > $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment