1、直接测试
root@DESKTOP-1N42TVH:/home/test2# ls a.txt root@DESKTOP-1N42TVH:/home/test2# cat a.txt d g u k d g u k s d g c s d g c x v d e x v d e s q e t s q e t c g e g c g e g root@DESKTOP-1N42TVH:/home/test2# awk '{print NR, $0}' a.txt ## 直接输出行号 1 d g u k 2 d g u k 3 s d g c 4 s d g c 5 x v d e 6 x v d e 7 s q e t 8 s q e t 9 c g e g 10 c g e g root@DESKTOP-1N42TVH:/home/test2# awk '{printf("%02g %s\n", NR, $0)}' a.txt ## 输出等宽的行号 01 d g u k 02 d g u k 03 s d g c 04 s d g c 05 x v d e 06 x v d e 07 s q e t 08 s q e t 09 c g e g 10 c g e g
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。