sed -i 's/char/chara/g' filename  #这里是将filename的文件中所有的char替换为chara
sed '/^$/d' file #删除空白行
sed '2d' file #删除第二行
sed '2,$d' file #删除第二行到最后一行
sed '$d' file #删除最后一行
sed '/^test/'d file #删除开头为test的行
sed -i '2a\this is a test line' test.conf #将this is a test line添加至第二行