正则表达式搜索和替换程序 [英] Regex Search and Replace Program

查看:62
本文介绍了正则表达式搜索和替换程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一个简单而轻量级的程序来搜索文本文件并用正则表达式替换字符串?

Is there a simple and lightweight program to search over a text file and replace a string with regex?

推荐答案

搜索:grep - 简单快速.包含在 Linux 中,这里是 Windows 版本,不确定 Mac.

For searching: grep - simple and fast. Included with Linux, here's a Windows version, not sure about Mac.

替换:sed.这里是 Windows 版本,Mac 不确定.

For replacing: sed. Here's a Windows version, not sure about Mac.

当然,如果您想在搜索和替换时实际打开文件并查看其内容,可以使用 emacs.或者 ConTEXT.或者 vim.或者你有什么.;)

Of course, if you want to actually open up a file and see its contents while you search and replace, you can use emacs for that. Or ConTEXT. Or vim. Or what have you. ;)

另见 这个问题.

这篇关于正则表达式搜索和替换程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆