我无法替换文件中的文本,因为搜索短语包含单引号。
文件名名单.pinterp
&io
path_to_input = '.'
input_name = 'wrfout_d01_2006-09*00'
path_to_output = '.'
/
我正在使用 bash 脚本。我想要改变的是:
path_to_output = '.'
至:
path_to_output = '/myWorkDir/ALL_NEW/post_processed_files'
我曾尝试使用 perl,但出现错误。
perl -pi -e 's/path_to_output = '.'/ path_to_output = '/myWorkDir/ALL_NEW/post_processed_files'g;' namelist.pinterp
ERROR
./myPinterp.bash: line 13: path_to_output = '.': command not found
Bareword found where operator expected at -e line 1, near "s/path_to_output = ./ path_to_output = /myWorkDir"
syntax error at -e line 1, near "s/path_to_output = ./ path_to_output = /myWorkDir"
Execution of -e aborted due to compilation errors.
我错过了什么?我还能用什么?