datechange
来自「Tokyo Cabinet的Tokyo Cabinet 是一个DBM的实现。这里」· 代码 · 共 57 行
TXT
57 行
#! /bin/sh#================================================================# datechange# Replace date expressions#================================================================# set variablesLANG=CLC_ALL=Cexport LANG LC_ALLyear=`date '+%Y'`date=`date '+%Y-%m-%d'`fulldate=`date -R`regexsrc='\.(h|c|cc|cpp|cxx|java|pl|pm|pod|rb|rd|lua)$'regexman='\.[0-9]$'regexhtml='\.html$'# edit source filesfind . -type f | egrep "$regexsrc" |while read filedo echo "$file" sed "/opyright/ s/\\(20[0-9][0-9]\\)-\\(20[0-9][0-9]\\)/\\1-$year/" "$file" > "$file.tmp" mv -f "$file.tmp" "$file"done# edit manual filesfind . -type f | egrep "$regexman" |while read filedo echo "$file" sed "/\\.TH/ s/\\(20[0-9][0-9]\\)-\\([0-9][0-9]\\)-\\([0-9][0-9]\\)/$date/" "$file" > "$file.tmp" mv -f "$file.tmp" "$file"done# edit HTML filesfind . -type f | egrep "$regexhtml" |while read filedo echo "$file" sed -e "/opyright/ s/\\(20[0-9][0-9]\\)-\\(20[0-9][0-9]\\)/\\1-$year/" -e "/<div class=\"note\">/ s/Last Update: *\\([A-Z][a-z][a-z], [0-9][0-9] [A-Z][a-z][a-z] 20[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9] +[0-9][0-9]*\\)/Last Update: $fulldate/" "$file" > "$file.tmp" mv -f "$file.tmp" "$file"done# exit normallyexit 0# END OF FILE
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?