找回密码
 注册
搜索
热搜: 回贴
微赢网络技术论坛 门户 服务器 Linux/BSD 查看内容

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

2009-12-20 13:40| 发布者: admin| 查看: 63| 评论: 0|原作者: 玄霄


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









最新评论

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-30 21:21 , Processed in 0.393577 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

返回顶部