摘要: 1、删除开头的空行 [root@centos79 test]# cat a.txt a g r e i x k like a f g liker a g r e a f g liker [root@centos79 test]# cp a.txt a.txt.bak [root@centos79 t 阅读全文
posted @ 2021-07-04 23:38 小鲨鱼2018 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 1、 [root@centos79 test]# echo $a [root@centos79 test]# a=10 [root@centos79 test]# echo $a 10 [root@centos79 test]# unset a ## 清除变量a [root@centos79 tes 阅读全文
posted @ 2021-07-04 23:10 小鲨鱼2018 阅读(117) 评论(0) 推荐(0) 编辑
摘要: linux系统中如何删除行首、行尾的空格 1、删除行首空格、制表符 [root@centos79 test]# ls a.txt [root@centos79 test]# cat a.txt a g r e i x k like a f g liker a g r e a f g liker [r 阅读全文
posted @ 2021-07-04 22:56 小鲨鱼2018 阅读(1355) 评论(0) 推荐(0) 编辑
摘要: 1、在所有行后添加空行 [root@centos79 test]# cat a.txt a g r e i x k like a f g liker s t 2 a b d s i [root@centos79 test]# awk '{print $0 "\n"}' a.txt a g r e i 阅读全文
posted @ 2021-07-04 22:47 小鲨鱼2018 阅读(795) 评论(0) 推荐(0) 编辑
摘要: 1、测试数据如下 [root@centos79 test]# ls a.txt [root@centos79 test]# cat a.txt a g r e i x k like a f g liker [root@centos79 test]# cat -A a.txt a g r e$ $ $ 阅读全文
posted @ 2021-07-04 20:45 小鲨鱼2018 阅读(791) 评论(0) 推荐(1) 编辑
摘要: linux系统中如何删除空行。 1、测试数据 a.txt [root@centos79 test]# ls a.txt [root@centos79 test]# cat a.txt a g r e i x k like a f g liker [root@centos79 test]# cat - 阅读全文
posted @ 2021-07-04 20:17 小鲨鱼2018 阅读(324) 评论(0) 推荐(0) 编辑
摘要: 1、 [root@centos79 test]# cat a.txt a g r e u c j alike i x k like a f g liker a f h g liker s g e g [root@centos79 test]# grep "^a" a.txt ## 查找以a开头的行 阅读全文
posted @ 2021-07-04 19:37 小鲨鱼2018 阅读(8966) 评论(0) 推荐(0) 编辑
摘要: 1、测试数据 [root@centos79 test]# ls a.txt [root@centos79 test]# cat a.txt a g e u c j alike i x k like w f g liker s g e g [root@centos79 test]# echo "b.t 阅读全文
posted @ 2021-07-04 19:18 小鲨鱼2018 阅读(920) 评论(0) 推荐(0) 编辑
摘要: 1、测试数据 [root@centos79 test]# cat a.txt a g e u c j alike i x k like w f g liker s g e g [root@centos79 test]# grep like a.txt u c j alike i x k like w 阅读全文
posted @ 2021-07-04 18:57 小鲨鱼2018 阅读(619) 评论(0) 推荐(0) 编辑
摘要: linux系统中如何删除文件的最后几行 1、 [root@centos79 test]# cat a.txt a g e d c j i x a e i r x v b x e w [root@centos79 test]# head -n -2 a.txt a g e d c j i x a e 阅读全文
posted @ 2021-07-04 18:14 小鲨鱼2018 阅读(961) 评论(0) 推荐(0) 编辑
摘要: 1、linux系统中如何统计文件的行数 [root@centos79 test]# cat b.txt a g e d c j i x a [root@centos79 test]# wc -l b.txt 3 b.txt 2、 [root@centos79 test]# cat b.txt a g 阅读全文
posted @ 2021-07-04 17:58 小鲨鱼2018 阅读(1183) 评论(0) 推荐(0) 编辑