001、shell实现
[root@pc1 test2]# ls a.txt [root@pc1 test2]# cat a.txt ## 测试数据 1 4 6 10 8 16 17 20 [root@pc1 test2]# cat a.txt | tr " " "\n" | sed -e '1d' -e '$d' | sed 'N; s/\n/ /' | awk '$2 <= $1 { print NR"-"NR + 1, $0}' 2-3 10 8
[root@pc1 test2]# ls a.txt [root@pc1 test2]# cat a.txt 1 4 6 10 8 16 17 20 23 30 32 39 40 45 43 50 [root@pc1 test2]# cat a.txt | tr " " "\n" | sed -e '1d' -e '$d' | sed 'N; s/\n/ /' | awk '$2 <= $1 { print NR"-"NR + 1, $0}' 2-3 10 8 7-8 45 43
002、python实现
标签:test2,一组,交叉,pc1,cat,sed,linux,txt,root From: https://www.cnblogs.com/liujiaxin2018/p/16895878.html