1. sed
sed 是一种流编辑器,它是文本处理中非常常用的工具,能够完美的配合正则表达式使用,功能非常强大。
mkdir playground touch test.txt echo "Hello world!" >> test.txt cat>test.txt<<EOF > i love you > my honey > be easy > last row > EOF
例如:
删除文档的第一行
sed -i '1d' test.txt cat test.txt
my honey be easy last row
删除文档的第三行
sed -i '3d' test.txt cat test.txt
my honey
be easy
删除文档的最后一行
sed -i '$d' test.txt cat test.txt
my honey
未完待续……