ITeye博客

linux 修改文件中某一行

wushexin · 2011-04-27 18:21 · linux shell · 操作系统 · Linux · Markdown

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

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。