Jig*_*dhi 3 shell tcsh csh quoting
我尝试了删除大括号之间的文本时给出的代码
但是我正面临着关于 sed 事件的这个不同的错误。
文件包含:
This is {
{the multiline
text} file }
that wants
{ to {be
changed}
} anyway.
Run Code Online (Sandbox Code Playgroud)
sed ':again;$!N;$!b again; s/{[^}]*}//g' file
锻炼中可能出了什么问题?
错误
N: Event not found.
Run Code Online (Sandbox Code Playgroud)
您必须逃脱!
以防止csh/tcsh
执行历史扩展。尽管您!
用单引号编写,但它们仍然进行历史扩展。
尝试:
sed ':again;$\!N;$\!b again; s/{[^}]*}//g' file
Run Code Online (Sandbox Code Playgroud)
或者您可以编写一个脚本调用-f script.sed
(阅读sed 常见问题)。
归档时间: |
|
查看次数: |
2260 次 |
最近记录: |