mar*_*eks 1 bash shell awk sed
我需要一个shell脚本来查找和替换类似的文本:
For each line in a file
find equation mark "="
remove everything up to the equation mark on that line and replace it with the string cuts[Counter] where Counter counts how many times such substitutions have been made.
Run Code Online (Sandbox Code Playgroud)
开始使用这样的脚本可以帮助我吗?
假设你的意思是"达到第一个等式标记......"并且你想保留=,这应该这样做:
awk '{c += sub(/[^=]+=/,"cuts["c+0"]=") }1' file
Run Code Online (Sandbox Code Playgroud)