Created
June 14, 2016 08:55
-
-
Save bretsko/e9aa33b4c3438f5f45e4b87fb90d2070 to your computer and use it in GitHub Desktop.
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
# When I read source files I often stumble upon big headers containing copyright information and other info. | |
# Scrolling through multiple files with such headers is really frustrating when all I want is to read, not modify. | |
# So I developped this script to clear out those headers only to make convenient READING the sources. | |
# Of course, make a safe reading copy before proceding with this. | |
# It scans the first 20 lines (change to whatever you like) and deletes all the lines starting with //. | |
# It stops at the first encounetered hash sign, which signify the first includes. | |
awk -i inplace '!( NR<20 && !/^[[:blank:]]*#.*)/ && /^[[:blank:]]*($|[/].*)/)' file.c | |
# So I would use find to get all my C++ files | |
find . -regex ".*\.\(c\|cc\|cpp\|cp\|cxx\|c++\|h\|hh\|hpp\|hxx\)" | |
# and then just combine the commands | |
find . -regex ".*\.\(c\|cc\|cpp\|cp\|cxx\|c++\|h\|hh\|hpp\|hxx\)" \ | |
-exec awk -i inplace '!( NR<20 && !/^[[:blank:]]*#.*)/ && /^[[:blank:]]*($|[/].*)/)' {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment