打印文件某一行的简单方法

388阅读 0评论2008-11-26 futuregod
分类:LINUX

sed -n 'np' filename

Second n is the line number of the filename;

For example, if you want to print the second line of filename, you can run

sed -n '2p' filename


sed -n 'x,yp' filename
This command will output content of filename between line x and line y.
For example, if you want to print content between line 3 to line 10, you can run
sed -n '3,10p' filename




上一篇:The End of libc5: A Mini-Interview with H.J Lu
下一篇:Building And Using Static And Shared "C" Libraries