Linux command to replace string in LARGE file with

2019-02-09 07:40发布

I have a huge SQL file that gets executed on the server. The dump is from my machine and in it there are a few settings relating to my machine. So basically, I want every occurance of "c://temp" to be replace by "//home//some//blah"

How can this be done from the command line?

7条回答
The star\"
2楼-- · 2019-02-09 08:38

The sed command can do that. Rather than escaping the slashes, you can choose a different delimiter (_ in this case):

sed -e 's_c://temp/_/home//some//blah/_' file1.txt > file2.txt
查看更多
登录 后发表回答