随笔分类 - linux shell
摘要:001、 方法1 [root@pc1 test01]# ls a.txt test.sh [root@pc1 test01]# cat a.txt ## 测试数据, 依据最后一列展开为多行 chrY 2657879 2658063 CTCF 652 GM19239 chrY 2664424 2664
阅读全文
摘要:001、 [root@pc1 test02]# ls a.txt [root@pc1 test02]# cat a.txt ## 测试数据 01 02 03 04 05 06 07 08 09 10 ## 获取数组的长度 [root@pc1 test02]# awk 'BEGIN{ay["a"] =
阅读全文
摘要:001、方法1 [root@pc1 test03]# ls a.txt [root@pc1 test03]# cat a.txt ## 测试数据 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
阅读全文
摘要:001、 [root@pc1 test03]# ls a.txt [root@pc1 test03]# cat a.txt ## 测试数据 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
阅读全文
摘要:001、find >>> str1 = "xyabmnabkj" ## 测试字符串 >>> for i in enumerate(str1): ... print(i) ## 列出每个字符的索引 ... (0, 'x') (1, 'y') (2, 'a') (3, 'b') (4, 'm') (5,
阅读全文
摘要:001、 [root@pc1 test01]# ls ## 测试文件 a.txt test01 test02 test03 [root@pc1 test01]# find ./ -type f -exec ls -l {} \; ## 列出文件大小 -rw-r--r--. 1 root root 2
阅读全文
摘要:001、 [root@pc1 test01]# cat a.txt A:10 B:5 C:12 [root@pc1 test01]# cat b.txt 100 A 50 B 88 K 99 Y 42 C [root@pc1 test01]# awk '{if(NR == FNR) {ay[$1]
阅读全文
摘要:001、 正确做法 [root@pc1 test01]# ls a.txt b.txt [root@pc1 test01]# cat a.txt A:10 B:5 C:12 [root@pc1 test01]# cat b.txt 100 A 50 B 42 C [root@pc1 test01]#
阅读全文
摘要:001、 方法1 [root@pc1 test01]# ls a.txt b.txt [root@pc1 test01]# cat a.txt A:10 B:5 C:12 [root@pc1 test01]# cat b.txt 100 A 50 B 42 C [root@pc1 test01]#
阅读全文
摘要:001、 -F 指定 [root@pc1 test01]# ls a.txt [root@pc1 test01]# cat a.txt a:b:c 3:8:k f:6:3 [root@pc1 test01]# awk -F ":" '{print $1}' a.txt a 3 f 002、-v FS
阅读全文
摘要:001、去重复保持原来的顺序 [root@pc1 test01]# ls a.txt [root@pc1 test01]# cat a.txt ## 测试数据 1 2 5 5 3 3 7 7 4 [root@pc1 test01]# awk 'ay[$0]++' a.txt ## 输出重复项,且保持
阅读全文
摘要:001、 [root@pc1 test02]# ls a.txt test.sh [root@pc1 test02]# cat a.txt ## 测试序列 GATATATGCATATACTT [root@pc1 test02]# cat test.sh ## 计算程序 #!/bin/bash len
阅读全文
摘要:001、configure: error: libcurl library not found 002、解决方法 [root@pc1 test01]# yum -y install libcurl-devel 。
阅读全文
摘要:001、configure: error: liblzma development files not found 002、解决方法 [root@pc1 test01]# yum -y install xz-devel 。
阅读全文
摘要:001、configure: error: libbzip2 development files not found 002、解决方法 [root@pc1 test01]# yum -y install bzip2-devel 。
阅读全文
摘要:001、configure: error: zlib development files not found 002、解决方法: [root@pc1 test01]# yum -y install zlib-devel 。
阅读全文
摘要:001、 [root@PC1 test02]# ls a.txt b.txt [root@PC1 test02]# cat a.txt ## 测试数据 77 jj jj ee ww [root@PC1 test02]# cat b.txt ## 测试数据 xx rr ee 88 ww [root@P
阅读全文
摘要:001、 [root@PC1 test02]# ls a.txt b.txt [root@PC1 test02]# cat a.txt ## 测试文件 88 77 jj ff yy rr tt [root@PC1 test02]# cat b.txt ## 测试文件 uu rr tt uu 77 8
阅读全文
摘要:001、for循环 [root@PC1 test02]# ls a.txt [root@PC1 test02]# cat a.txt ## 测试数据 1 2 3 4 5 6 7 8 9 10 11 12 [root@PC1 test02]# awk '{sum = 0; for(i = 1; i <
阅读全文
摘要:001、FIELDWIDTHS 用于指定输出字段的宽度 [root@PC1 test02]# ls a.txt [root@PC1 test02]# cat a.txt ## 测试数据 abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ [ro
阅读全文

浙公网安备 33010602011771号