Linux command to replace string in LARGE file with another string

前端 未结 7 750
终归单人心
终归单人心 2021-01-02 13:33

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 oc

7条回答
  •  醉梦人生
    2021-01-02 14:06

    perl -pi -e 's#c://temp#//home//some//blah#g' yourfilename
    

    The -p will treat this script as a loop, it will read the specified file line by line running the regex search and replace.

    -i This flag should be used in conjunction with the -p flag. This commands Perl to edit the file in place.

    -e Just means execute this perl code.

    Good luck

提交回复
热议问题