Created
October 25, 2016 02:14
-
-
Save selfboot/73d14ff0801156781785bae6e5d7732b to your computer and use it in GitHub Desktop.
软件著作权代码格式处理(需要在项目的根目录运行)
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
| #! /usr/bin/env sh | |
| # Find all the src file in your project | |
| py_files=`find . -name '*.py'` | |
| html_files=`find . -name '*.html'` | |
| css_files=`find . -name '*.css'` | |
| for i in $py_files | |
| do | |
| filename=$(basename "$i") | |
| dir_path=$(dirname "$i") | |
| file_path="$dir_path/$filename" | |
| echo "${file_path:2}" >> "all.txt" | |
| cat $i >> "all.txt" | |
| done | |
| for i in $html_files | |
| do | |
| filename=$(basename "$i") | |
| dir_path=$(dirname "$i") | |
| file_path="$dir_path/$filename" | |
| echo "${file_path:2}" >> "all.txt" | |
| cat $i >> "all.txt" | |
| done | |
| for i in $css_files | |
| do | |
| filename=$(basename "$i") | |
| dir_path=$(dirname "$i") | |
| file_path="$dir_path/$filename" | |
| echo "${file_path:2}" >> "all.txt" | |
| cat $i >> "all.txt" | |
| done |
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
| #! /usr/bin/env sh | |
| # 删除空白行 和 python中以 # 开头的注释行 | |
| py_files=`find . -name '*.py'` | |
| html_files=`find . -name '*.html'` | |
| css_files=`find . -name '*.css'` | |
| for i in $py_files | |
| do | |
| sed 's/#.*$//' $i > $i.out | |
| sed '/^$/d' $i > $i.out | |
| mv $i.out $i | |
| done | |
| for i in $html_files | |
| do | |
| sed '/^$/d' $i > $i.out | |
| mv $i.out $i | |
| done | |
| for i in $css_files | |
| do | |
| sed '/^$/d' $i > $i.out | |
| mv $i.out $i | |
| done |
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
| #! /usr/bin/env sh | |
| # 打印所有的项目源代码文件 | |
| py_files=`find . -name '*.py'` | |
| html_files=`find . -name '*.html'` | |
| css_files=`find . -name '*.css'` | |
| for i in $py_files | |
| do | |
| filename=$(basename "$i") | |
| dir_path=$(dirname "$i") | |
| file_path="$dir_path/$filename" | |
| echo "${file_path:2}" | |
| done | |
| for i in $html_files | |
| do | |
| filename=$(basename "$i") | |
| dir_path=$(dirname "$i") | |
| file_path="$dir_path/$filename" | |
| echo "${file_path:2}" | |
| done | |
| for i in $css_files | |
| do | |
| filename=$(basename "$i") | |
| dir_path=$(dirname "$i") | |
| file_path="$dir_path/$filename" | |
| echo "${file_path:2}" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment