-
-
Save palytoxin/253371bc2710043299f2848665bb3dae 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
#!/bin/bash | |
read_dir() { | |
for item in $(ls $1) | |
do | |
if [ -d $1"/"$item ];then | |
read_dir $1"/"$item | |
else | |
file=$1"/"$item | |
suffix=${file##*.} | |
# which files do you want to append | |
if [[ $suffix != "sh" && \ | |
$suffix != "png" && \ | |
$suffix != "xml" \ | |
]];then | |
cat $file >> all.txt | |
echo $file | |
echo -e '\n' >> all.txt | |
fi | |
fi | |
done | |
} | |
$(touch all.txt) | |
$(cat /dev/null > all.txt) | |
read_dir $1 | |
# rule and test | |
# /* comment */ | |
#sed -i 's/\/\*.*\*\///g' all.txt | |
# // comment | |
#sed -i 's/\/\/.*//g' all.txt | |
# # comment | |
sed -i '/^\s*#.*$/d' all.txt | |
# // "comment | |
sed -i "s/\/\/[^\"]*//" all.txt | |
# empty line | |
#sed -i '/^$/d' all.txt | |
sed -i '/^[[:space:]]*$/d' all.txt | |
# // | |
sed -i "/^[ \t]*\/\//d" all.txt | |
# <!-- comment --> | |
#sed -i ":begin; /<\!--/,/-->/ { /<\!--/! { $! { N; b begin }; }; s/<\!--.*-->/ /; };" all.txt | |
# /** */ | |
#sed -i ":begin; /\/\*\*/,/\*\// { /\*\//! { $! { N; b begin }; }; s/\/\*\*.*\*\// /; };" all.txt | |
# /** */ | |
#sed -i ":begin; /\/\*/,/\*\// { /\*\//! { $! { N; b begin }; }; s/\/\*.*\*\// /; };" all.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment