日度归档:2019-08-13

输出目录下所有文件内容

// 仅输出文件名
find . -name "*.php" -print -exec echo {} \;
// 输出内容
find . -name "*.php" -print -exec cat {} \;
// 输出内容到文件
find . -name "*.php" -print -exec cat {} \; > ~/output.txt

利用 git 统计代码贡献

git log --format='%aN' | sort -u | while read name; do echo -en "$name\t"; git log --author="$name" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -; done