希望
  • Home
  • Posts
  • Categories
  • Tags
  • About
工具

使用shell给文件每一行添加行号

2019-06-14 0 min read

使用shell给文件每一行添加行号,

如原始文件:

AAA
BB
C

输出文件:

1 AAA
2 BB
3 C

使用awk

awk '{print NR " " $1}' inputfile > outputfile

使用nl

nl inputfile > outputfile
Last updated on 2019-06-14
本地Docker加载阿里Mysql物理备份 kubectl集群访问环境配置
© 2025 希望 | Powered by hugo-theme-void | Total visits: