Last active
June 11, 2018 19:44
-
-
Save OAkyildiz/c09badb03210130569ed3eb57f1e805a to your computer and use it in GitHub Desktop.
[TRINA] Scripted Fix for robotsim_wrap.cxx: This file finds the code block to be moved and the target location and moves each line up. It is required by install_trina.sh
This file contains hidden or 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
| #!/bin/bash | |
| #move this | |
| tomove="return _wrap_new_WorldModel__SWIG_1(self, args);" | |
| #to where tis is: | |
| into="return _wrap_new_WorldModel__SWIG_2(self, args);" | |
| # calculate how many lines to shift | |
| fromln=$(grep -in "$tomove" Klampt/Python/klampt/src/robotsim_wrap.cxx | cut -d : -f 1) | |
| toln=$(grep -in "$into" Klampt/Python/klampt/src/robotsim_wrap.cxx | cut -d : -f 1) | |
| # calculate how many lines to shift | |
| block_start=$(( fromln-6 )) | |
| block_end=$(( fromln+2 )) | |
| shft=$(( toln-fromln )) | |
| echo "will move the code block from ln:$block_start to ln:$block_end $shft lines" | |
| #move lines staring from the top in a for loop | |
| echo "$(ls ${BASH_SOURCE[0]})" | |
| for n in $(seq $block_start $block_end) | |
| do | |
| printf %s\\n ${n}m$(( n+shft )) w q | ed -s Klampt/Python/klampt/src/robotsim_wrap.cxx | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment