Skip to content

Instantly share code, notes, and snippets.

@wcp1231
Created September 28, 2013 14:40
Show Gist options
  • Save wcp1231/6742738 to your computer and use it in GitHub Desktop.
Save wcp1231/6742738 to your computer and use it in GitHub Desktop.
修改静态文件路径版本的单行的ruby脚本,作用同之前的python脚本。直接在shell里执行即可
# 已知的bug是,如果一个元素分成几行就不会被匹配上
ruby -i.bak -rdate -pe '$_.gsub!(/(<(script|link|img)[^@%>]*=["][^"]*\.(js|css|png|jpg))/) {%Q|#{$1}?#{DateTime.now.strftime "%Y%m%d%H"}|}' ./**/*.jsp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment