Last active
December 12, 2015 10:09
-
-
Save mortennobel/4757446 to your computer and use it in GitHub Desktop.
replaces blocks of text surrounded by start and end symbol with a constant line (useful for simple preprocessing scripts)
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
awk '/insert_code_start/,/insert_code_end/ { if ( $0 ~ /insert_code_end/) print " // insert code here"; next} 1' < test.cpp > text_sub.cpp | |
# | |
# Example | |
# | |
# void main(){ | |
# // insert_code_start | |
# foo(); | |
# // insert_code_end | |
# } | |
# | |
# Turns into | |
# void main(){ | |
# // insert code here | |
# } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment