Last active
July 24, 2018 08:29
-
-
Save yuvalif/d8c6ab4c5c40da0555f2d1440743dc02 to your computer and use it in GitHub Desktop.
some preparations for converting a matlab/octave file to cpp
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
# fix comments | |
sed -i 's/%/\/\//g' $1 | |
# fix "end" | |
sed -i 's/end/}/g' $1 | |
# fix "3 dots" | |
sed -i 's/\.\.\.//g' $1 | |
# fix "elseif" | |
sed -i 's/elseif/}\nelse if/g' $1 | |
# fix "else" | |
sed -i 's/else/}\nelse\n{/g' $1 | |
# fix "error()" | |
sed -i 's/error(/assert(/g' $1 | |
# remove trailing spaces | |
sed -i 's/[ \t]*$//' $1 | |
# modify brackets of array my_arr | |
# sed -E 's/my_arr\(([^()]*)\)/my_arr[\1]/g' $1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment