zl程序教程

您现在的位置是:首页 >  工具

当前栏目

shell中sed命令

2023-09-14 09:06:19 时间

sed -i '/cd ${LDIR_DEST}\/webextend\/pc && ln -s \/hard\/www_winclient\/bboxpc.exe ./a\ \tcd ${LDIR_DEST}\/webextend\/pc && ln -s \/hard\/www_winclient\/'$i' .'

#參考别人后自己改的,主要是加了个变量

sed -i '4i dfsdfdsad' xxx.txt #Insert contents between the fourth and fifth line在第4行插入,原来的第四行跑到第五

#參考下边,些的上边的

sed -i '4c dfsdfdsad' xxx.txt #Insert contents in the line 4 and overwrite the old在第4行插入覆盖原来的第4行 

#下边的是学的http://kaoshi.china.com/linux/learning/617077-1.htm

sed -i '/'"$test"'/d' xxx.txt #删除某行。用内容删除。这就必须 加'""'



sed -i '/\[nand_para\]/a\flag = 1' filename.txt #这是别人的