使用bash在linux中编辑文件
假设我在文本文件中有以下内容:使用bash在linux中编辑文件,bash,Bash,假设我在文本文件中有以下内容: ................. value1= "2000"; justAtext= "hello Text" .................................. 我的问题是,是否有linux cmd允许我搜索文件,例如“value” 然后用其他类似的东西替换整个线路: ................. changedText= "Hello"; justAtext= &quo
.................
value1= "2000";
justAtext= "hello Text"
..................................
我的问题是,是否有linux cmd允许我搜索文件,例如“value”
然后用其他类似的东西替换整个线路:
.................
changedText= "Hello";
justAtext= "hello Text"
..................................
.................
changedText= "Hello";
justAtext= "hello Text"
..................................
提前感谢您的任何提示 是的,有几种方法。最快的国际海事组织:
输入
.................
value1= "2000";
justAtext= "hello Text"
..................................
假设此文本位于名为foo.txt的文件中
精化 sed-iE的/value1=.*/changedText=“Hello”/g'foo.txt
->替换同一文件上的内容(省略此选项,输出将打印在标准输出上)-i
->使用正则表达式-E
输出
.................
value1= "2000";
justAtext= "hello Text"
..................................