出现点和下划线时搜索并替换为 sed [英] Search and replace with sed when dots and underscores are present

查看:12
本文介绍了出现点和下划线时搜索并替换为 sed的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何替换 foo.与 foo_ 与 sed 简单地运行

How do I replace foo. with foo_ with sed simply running

sed 's/foo./foo_/g' file.php

不起作用.谢谢!

推荐答案

Escape the .:

Escape the .:

sed 's/foo./foo_/g' file.php

示例:

~$ cat test.txt 
foo.bar
~$ sed 's/foo./foo_/g' test.txt 
foo_bar

这篇关于出现点和下划线时搜索并替换为 sed的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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