📄 datechange
字号:
#! /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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -