sed
其中p代表打印,没有p会出错误
sed -n '2p' test.txt #显示第2行
sed -n '1,3p' test.txt #显示第1到3行
1.模糊匹配
sed -n '/a/'p test.txt #使用模式符号//
sed -n '3,/a/'p test.txt #只在第3行查询模式a
sed -n '1,$p' test.txt #显示所有数据,$代表结尾
要打印行号使用//=
sed -e '/music/=' quote.txt[@more@]
其中p代表打印,没有p会出错误
sed -n '2p' test.txt #显示第2行
sed -n '1,3p' test.txt #显示第1到3行
1.模糊匹配
sed -n '/a/'p test.txt #使用模式符号//
sed -n '3,/a/'p test.txt #只在第3行查询模式a
sed -n '1,$p' test.txt #显示所有数据,$代表结尾
要打印行号使用//=
sed -e '/music/=' quote.txt[@more@]
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8503278/viewspace-890006/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/8503278/viewspace-890006/