随笔分类 - linux shell
摘要:1、取正对角线 root@PC1:/home/test# ls a.txt root@PC1:/home/test# cat a.txt 1 D E 2 s d 3 d c root@PC1:/home/test# awk '{print $NR}' a.txt ## 取矩阵对角线元素,正对角线 1
阅读全文
摘要:1、 root@PC1:/home/test2# ls a.txt dir.1 test.csv test.ped root@PC1:/home/test2# ls -l total 8 -rw-r--r-- 1 root root 64 1月 21 23:14 a.txt drwxr-xr-x 2
阅读全文
摘要:1、测试数据 root@PC1:/home/test2# ls a.txt root@PC1:/home/test2# cat a.txt ## 测试数据 chenwu 05/99 4811 27 mary 02/22 1231 30 tom 09/15 1182 25 2、 root@PC1:/h
阅读全文
摘要:1、测试数据 root@PC1:/home/test# ls ## 测试数据 a.txt b.txt root@PC1:/home/test# cat a.txt w s g d w a root@PC1:/home/test# cat b.txt d a e d t c 2、取两个文件的交集 so
阅读全文
摘要:1、 root@PC1:/home/test# ls test.txt root@PC1:/home/test# cat test.txt 1 3 8 1 3 5 1 7 root@PC1:/home/test# sort test.txt | uniq -d ## 取出重复项 1 3 root@P
阅读全文
摘要:1、 root@PC1:/home/test# ls test.sh root@PC1:/home/test# cat test.sh #!/bin/bash #using a function in a script function func1 { ## shell自定义函数的格式之一是 fun
阅读全文
摘要:1、 root@PC1:/home/test# ls root@PC1:/home/test# for i in {A..D}; do for j in {A..D}; do echo $i"_"$j; done; done ## 生成A-D任意的两两组合 A_A A_B A_C A_D B_A B
阅读全文
摘要:linux 中awk命令实现统计频数 1、 root@PC1:/home/test# ls a.txt root@PC1:/home/test# cat a.txt 3 4 6 3 2 4 8 2 1 5 6 2 4 3 6 1 2 4 7 3 3 4 7 2 root@PC1:/home/test
阅读全文
摘要:1、循环数字 root@PC1:/home/test# ls root@PC1:/home/test# for((i = 1; i <= 5; i++)); do echo $i; done 1 2 3 4 5 2、 root@PC1:/home/test# ls root@PC1:/home/te
阅读全文
摘要:1、获取环境变量 export env 2、测试export 和 env: root@PC1:/home/test# ls root@PC1:/home/test# export > export.txt ## 生成文件 root@PC1:/home/test# ls export.txt root
阅读全文
摘要:1、测试数据 root@PC1:/home/test# ls test.txt root@PC1:/home/test# cat test.txt 3 4 2 2 1 9 5 7 5 7 8 4 2 3 4 6 2、统计每行数据的最大值 root@PC1:/home/test# ls test.tx
阅读全文
摘要:1、测试数据 root@PC1:/home/test# ls test.txt root@PC1:/home/test# cat test.txt 3 4 2 2 1 9 5 7 5 7 8 4 2 3 4 6 2、实现计算每行的和 root@PC1:/home/test# ls test.txt
阅读全文
摘要:1、测试数据 root@PC1:/home/test# ls test.txt root@PC1:/home/test# cat test.txt 3 4 2 2 1 9 5 7 5 7 8 4 2 3 4 6 2、输出每一列的最大值 root@PC1:/home/test# ls test.txt
阅读全文
摘要:1、测试数据 root@PC1:/home/test# ls test.txt root@PC1:/home/test# cat test.txt 3 4 2 9 1 3 5 4 3 7 8 4 2 3 4 6 2、对每一列数据进行求和 root@PC1:/home/test# ls test.tx
阅读全文
摘要:linux中date命令用于获取当前的日期 1、 root@PC1:/home/test# date ##在终端直接输入date即可获取当前的日期信息 2022年 01月 14日 星期五 12:30:42 CST 2、 root@PC1:/home/test# date +%Y ##年 2022 r
阅读全文
摘要:1、测试数据 root@PC1:/home/test# ls a.txt test.txt root@PC1:/home/test# cat test.txt 3 s j d z 4 x c 8 3 f z c m d root@PC1:/home/test# cat a.txt 1 2 3 2、
阅读全文
摘要:1、测试数据 root@PC1:/home/test# ls test.map root@PC1:/home/test# cat test.map 01 SNP01 55910 02 SNP02 85204 03 SNP03 122948 04 SNP04 203750 05 SNP05 31270
阅读全文
摘要:1、测试数据 root@DESKTOP-1N42TVH:/home/test2# ls a.map root@DESKTOP-1N42TVH:/home/test2# cat a.map ##测试数据 1 s64199.1 0 55910 1 OAR19_64675012.1 0 85204 1 O
阅读全文
摘要:1、测试数据 root@DESKTOP-1N42TVH:/home/test2# ls a.txt root@DESKTOP-1N42TVH:/home/test2# cat a.txt aa 2413 bb 3322 cc 4231 root@DESKTOP-1N42TVH:/home/test2
阅读全文
摘要:1、-k 指定域 + 位置 root@DESKTOP-1N42TVH:/home/test# ls a.txt root@DESKTOP-1N42TVH:/home/test# cat a.txt ## 测试数据 google 110 5000 baidu 100 5000 guge 50 3000
阅读全文