随笔分类 - linux shell
摘要:001、打包 [root@pc1 test3]# ls a.txt b.txt c.map df110 tmp1 [root@pc1 test3]# tar -cf all.tar * ## 打包 [root@pc1 test3]# ls all.tar a.txt b.txt c.map df11
阅读全文
摘要:001、 [root@pc1 test3]# ls a.txt [root@pc1 test3]# cat a.txt ## 测试数据 r d u y f s x v y [root@pc1 test3]# rev a.txt ## 实现按列反转 u d r s f y y v x
阅读全文
摘要:001、 [root@pc1 test]# cat a.txt 1 2 3 4 5 6 7 8 9 10 [root@pc1 test]# awk -v a=$(awk 'END{if(NR % 3 != 0) {printf("%d", NR / 3 + 1)} else {print NR /
阅读全文
摘要:001、 [root@pc1 test]# ls a.txt [root@pc1 test]# cat a.txt ## 测试数据 1 2 3 4 5 6 7 8 9 10 ## 转换为两列数据 [root@pc1 test]# cat a.txt | paste -s -d " " | awk '
阅读全文
摘要:001、paste -s 实现 [root@pc1 test]# ls a.txt [root@pc1 test]# cat a.txt 1 2 3 4 5 [root@pc1 test]# paste -s a.txt ## paste 将一列数据转换为一行数据 1 2 3 4 5 [root@p
阅读全文
摘要:001、 [root@pc1 test]# ls a.txt [root@pc1 test]# cat a.txt ## 测试数据 1 2 3 4 5 6 [root@pc1 test]# sed '3a xx' a.txt ## 在第3行后面插入内容 1 2 3 xx 4 5 6
阅读全文
摘要:001、 >>> list1 ## 测试列表 [1, 2, 3, 4, 5] >>> list1.insert(-1,"xxx") ## 在列表最后以为之前插入数据 >>> list1 [1, 2, 3, 4, 'xxx', 5] >>> list1.insert(-2,"kkk") ## 在列表最
阅读全文
摘要:001、 [root@pc1 test]# ls a.txt b.txt c.txt [root@pc1 test]# ll -h ## 测试文件 total 4.0K -rw-r--r--. 1 root root 0 Oct 28 16:36 a.txt -rw-r--r--. 1 root r
阅读全文
摘要:001、 [root@pc1 test]# ls a.txt A.TXT b.txt B.TXT [root@pc1 test]# find ./ -name "a.txt" ## 查找a.txt ./a.txt [root@pc1 test]# ls a.txt A.TXT b.txt B.TXT
阅读全文
摘要:001、 [root@pc1 test]# ls a.txt b.txt c.txt d.txt e.txt m.map n.map x.csv y.csv [root@pc1 test]# find ./ -name "*.map" ## 查找当前目录中所有的map文件 ./m.map ./n.m
阅读全文
摘要:001、 [root@pc1 test]# ls ## 测试文件 a.txt b.txt c.txt d.txt e.txt [root@pc1 test]# ll -h total 250M -rw-r--r--. 1 root root 100M Oct 28 16:06 a.txt -rw-r
阅读全文
摘要:001、 [root@pc1 test]# ls a.fa [root@pc1 test]# cat a.fa ## 测试fasta文件 >chr1 aatt cc >chr2 ttgg ccgg >chr3 aa [root@pc1 test]# awk '{if($0 ~ /^>/) {prin
阅读全文
摘要:001、统计字符数(包括空格和换行符) [root@pc1 test]# ls a.txt [root@pc1 test]# cat a.txt ## 测试文件 ad t d [root@pc1 test]# wc -c a.txt ## wc -c命令统计字符数,包含换行符和空格 7 a.txt
阅读全文
摘要:001、 [b20223040323@admin1 test2]$ ls test.sh [b20223040323@admin1 test2]$ cat test.sh ## 测试脚本 #!/bin/bash a="abc" b="abc" if [ $a == $b ] then echo "i
阅读全文
摘要:001、 [root@pc1 test2]# ls a.txt [root@pc1 test2]# cat a.txt ## 测试数据 j d e w e th d e s d g e t f g w e t [root@pc1 test2]# sed 's/e.*e//' a.txt ## 删除e
阅读全文
摘要:001、 [root@pc1 test]# ls a.csv a.txt b.csv b.txt c.csv [root@pc1 test]# ll -h ## 测试文件 total 430M -rw-r--r--. 1 root root 20M Oct 26 18:02 a.csv -rw-r-
阅读全文
摘要:001、 [root@pc1 test]# ls test.txt [root@pc1 test]# cat test.txt 1 2 3 4 5 [root@pc1 test]# sed "$d" test.txt 1 2 3 4 5 [root@pc1 test]# sed '$d' test.
阅读全文
摘要:001、 [root@localhost test3]# ls a34 a45 b34 b54 c23 c34 dirab [root@localhost test3]# tree . ├── a34 ├── a45 ├── b34 ├── b54 ├── c23 ├── c34 └── dirab
阅读全文
摘要:001、问题 002、问题原因 原因为升级python后新建了软连接指向了新版本,除非同时升级yum不然无法使用。需要手动更改报错文件指向python2后即可解决。 003、解决方法 找出python2.7的路径 whereis python 编辑报错的配置文件,vim /usr/libexec/u
阅读全文
摘要:001、问题 except KeyboardInterrupt, e: 002、问题原因 2.原因:yum需要用python2编译,如果服务器安装的是python3并作为默认编译器的话,就会出现这个错误。 003、解决方法 找到python2的路径: whereis python 004、修改yum
阅读全文