Chinaunix首页 | 论坛 | 博客
  • 博客访问: 370451
  • 博文数量: 61
  • 博客积分: 2451
  • 博客等级: 上尉
  • 技术积分: 650
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-06 21:24
文章分类

全部博文(61)

文章存档

2012年(1)

2011年(44)

2010年(16)

分类: LINUX

2011-03-09 23:10:27

cat 要显示行号的话得加上-n (显示空行行号) –b (不显示空行行号)

如:

[root@Server1 shelllearn]#cat a
hello   world!

xdimh

[root@Server1 shelllearn]#cat -b a
     1  hello   world!

     2  xdimh

[root@Server1 shelllearn]#cat -n a
     1  hello   world!
     2
     3  xdimh

但是不能对行号进行操作比如想让行号在第一列,这是就可以通过nl

nl可以自动输出行号

[root@Server1 shelllearn]#nl a
     1  hello   world!

     2  xdimh

对行号的输出有是那种格式

通过选项-n指定

三个参数

ln rn 和 rz

[root@Server1 shelllearn]#nl -n ln a
1       hello   world!

2       xdimh
[root@Server1 shelllearn]#man nl
[root@Server1 shelllearn]#nl -n rn a
     1  hello   world!

     2  xdimh
[root@Server1 shelllearn]#nl -n rz a
000001  hello   world!

000002  xdimh

-b 选项的两个参数

t

a

[root@Server1 shelllearn]#nl -b a a
     1  hello   world!
     2
     3  xdimh
[root@Server1 shelllearn]#nl -b t a
     1  hello   world!

     2  xdimh

-w 选项

行号占几列

[root@Server1 shelllearn]#nl -n rz -w 2 a
01      hello   world!

02      xdimh

阅读(1472) | 评论(0) | 转发(0) |
0

上一篇:rename 简单使用

下一篇:chattr 与 lsattr

给主人留下些什么吧!~~