更新时间:2023-01-11 21:06:04
这可能对你有用(GNU sed):
This might work for you (GNU sed):
sed ':a;$!{N;ba};s/jack/'"$var"'/2' file
这会将文件拖入内存,然后将第二次出现的 jack
替换为 $var
.
This slurps the file into memory and then substitutes the second occurence of jack
for $var
.