sed -i  "1s/oldstr/newstr/" filename

示例:
config文件:

[wusx@centos245 gather]$ cat config 
start=359822
end=550000
threads=15
output=/home/wusx/gather/output
log=/home/wusx/gather/_wget.log

#将当前下的文档序列,写回config文件。
sed -i "1s/start=$(($i-1))/start=$i/" /home/wusx/gather/config
 
Logo

更多推荐