如何在Ubuntu Linux中搜索替换文件中的内容? [英] How to search-replace content within files in Ubuntu Linux?
本文介绍了如何在Ubuntu Linux中搜索替换文件中的内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的平台:Ubuntu Linux操作系统的工作站
在一个目录,我havea一系列文件,具有文件名xxx_1.in到xxx_50.in
对于每个文件,我想将abc替换为def。如果我单独做,我应该输入:克/ ABC / s的高清// / G
如何编写一个脚本来处理所有的文件进行一次
解决方案
SED -i的/ ABC / DEF / G'XXX _ *在$。 b $ b
应该足够了
My platform: Ubuntu linux workstation
In a directory, I havea series of files, with file name xxx_1.in to xxx_50.in
For each file, I want to replace abc to def. If I do it individually, I should type :g/abc/s//def/g
How to write a script to process all of the files at once?
解决方案
sed -i 's/abc/def/g' xxx_*.in
should be enough
这篇关于如何在Ubuntu Linux中搜索替换文件中的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文