在脚本中使用 Vim Script [批]处理文件

RT @http://superuser.com/questions/22455/vim-what-is-the-ex-mode-for-batch-processing-for Ex-Mode is mostly for performing the same action on a number of files. Say you have 25 .html files all with: <a href="/home.html"> ... Instead of opening each one of those, you could use Ex-mode to change it all to index.html: vim -E -s bob.html <<-EOF %substitute/home.html/index.html/ update quit EOF PS @http://tinyurl.com/2f7dpgg > also, make sure that last "eof" begins at the first column. If it > doesn't, the "here doc" won't recegnize it. You should really quote some relevant text from the previous post… Also, the “eof” marker in a heredoc does NOT have to start in the first column, if you use this syntax, leading tabs will be stripped: some_command <<-eof blah blah blah eof Note the “-e” after the “«”… Kevin

2010-09-20 · wuan

s60 双向同步 Google 日历

RT @http://mooninsky.net/sync-google-calendar-with-s60-mobile-phone 创建 GooSync 账号 登陆GooSync主页,注册一个GooSync帐号; 进入自己的邮箱等待激活邮件,激活后登陆; 选择对应自己的手机型号; 确认同步日历,并且同意Goosync对于你的google 日历的访问授权; 填写手机号码,等待配置短信发过来; 接收短信,左软键选择选项->保存配置,...

2010-09-19 · wuan

村上春树

说: 我一直以为人是慢慢变老的,其实不是,人是一瞬间变老的。 说: 在某种情况下,一个人的存在本身就要伤害另一个人。 说: 突然,遇到一个百分之百的女孩。 说: 在一堵坚硬的高墙和撞向他的鸡蛋之间,我会永远站在鸡蛋这一边。 说: 希望你下辈子不要改名,这样我会好找你一点。有时失去不是忧伤,而是一种...

2010-09-17 · wuan

公益广告

2010-09-14 · wuan

po2xls

#!/usr/bin/env sh # # =================================== # %s/""$\n\|"$\n^"\|$\n^$\|^#.*$\n//g # =================================== # 1. s/""$\n//g 删除空字符串 # 2. s/"$\n^"//g 多行合并为一行 # 3. s/$\n^$//g 删除空行 # 4. s/^#.*$//g 删除注释 # # ================= # %g/^msgstr/-1join # ================= # 合并 msgid 和 msgstr 到一行 # # ==================================================== # %s/^msgid "\(.\+\)" msgstr "\?\([^"]*\)"\?$/\1\t\2/g # ==================================================== # 用制表符 <TAB> 格式化,并删除字符串前后的双引号 # # ======================================================= # 1s/^msgid msgstr ".*$/msgid\tmsgstr\tmsgstr in french / # ======================================================= # 更新第一行,作为标题栏 # # =========== # U s e a g e # =========== # $ chmod u+x po2xls # $ po2xls *.po # for file in "$@";...

2010-09-12 · wuan