参考了网上诸多资料,还是这个靠谱一些,以后有时间自己扩展一个函数就更方便了。
先说说替换步骤。
1、附件中有示例文件。解压到本地目录。目的是把.js后缀的文件中的my替换为see。
2、运行emacs,然后运行:m-x find-dired 意思是:运行外部命令 find , 产生文件列表,然后进入 dired 模式。然后选择示例文件夹的目录。匹配模式就选 * 匹配所有文件。
[img]http://dl.iteye.com/upload/attachment/0080/0348/772dfaeb-6069-3039-a800-9471bc97e97b.png[/img]
[img]http://dl.iteye.com/upload/attachment/0080/0350/dc73cfdf-8b56-34da-9a4f-a485309cf586.png[/img]
[img]http://dl.iteye.com/upload/attachment/0080/0352/5b2e99e7-4e62-302e-97c5-c2b1cabd858e.png[/img]
[img]http://dl.iteye.com/upload/attachment/0080/0354/231eea3e-5e2f-3769-a657-027134ffa7a9.png[/img]
3、运行:m-x dired-mark-extension 标记扩展名为js的文件,随后输入js
[img]http://dl.iteye.com/upload/attachment/0080/0356/3cd4d18c-0e72-30de-82ce-e6873f3ed372.png[/img]
4、运行:m-x dired-do-query-replace-regexp 进行替换:my ret see ret然后输入!默认全部替换,y单个替换,n不替换
替换完成。
[img]http://dl.iteye.com/upload/attachment/0080/0358/a41f6aed-8f69-38d8-ab77-3381abe309e5.png[/img]
先说说替换步骤。
1、附件中有示例文件。解压到本地目录。目的是把.js后缀的文件中的my替换为see。
2、运行emacs,然后运行:m-x find-dired 意思是:运行外部命令 find , 产生文件列表,然后进入 dired 模式。然后选择示例文件夹的目录。匹配模式就选 * 匹配所有文件。
[img]http://dl.iteye.com/upload/attachment/0080/0348/772dfaeb-6069-3039-a800-9471bc97e97b.png[/img]
[img]http://dl.iteye.com/upload/attachment/0080/0350/dc73cfdf-8b56-34da-9a4f-a485309cf586.png[/img]
[img]http://dl.iteye.com/upload/attachment/0080/0352/5b2e99e7-4e62-302e-97c5-c2b1cabd858e.png[/img]
[img]http://dl.iteye.com/upload/attachment/0080/0354/231eea3e-5e2f-3769-a657-027134ffa7a9.png[/img]
3、运行:m-x dired-mark-extension 标记扩展名为js的文件,随后输入js
[img]http://dl.iteye.com/upload/attachment/0080/0356/3cd4d18c-0e72-30de-82ce-e6873f3ed372.png[/img]
4、运行:m-x dired-do-query-replace-regexp 进行替换:my ret see ret然后输入!默认全部替换,y单个替换,n不替换
替换完成。
[img]http://dl.iteye.com/upload/attachment/0080/0358/a41f6aed-8f69-38d8-ab77-3381abe309e5.png[/img]