Last active
May 7, 2019 15:33
-
-
Save dbuse/1343fce522fd49cdcceb37e6c77c47de to your computer and use it in GitHub Desktop.
Convert OMNeT++ .vec files into long-format (tidy) csv file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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