随笔分类 - linux shell
摘要:001、 [root@PC1 test]# ls SraRunInfo (2).csv [root@PC1 test]# mv SraRunInfo (2).csv new_name ## 复制文件名重命名报错 -bash: syntax error near unexpected token `(
阅读全文
摘要:001、 [root@PC1 test]# ls ## 测试数据 SraRunInfo(1).csv SraRunInfo(2).csv SraRunInfo(3).csv SraRunInfo(4).csv SraRunInfo(5).csv SraRunInfo.csv [root@PC1 te
阅读全文
摘要:001、 [root@PC1 test]# ls a b c d.txt x y.txt [root@PC1 test]# ll -h ## 测试数据,两个文件名中都有空格 total 8.0K -rw-r--r--. 1 root root 9 Dec 31 20:56 a b c d.txt -
阅读全文
摘要:001、 [root@PC1 test]# ls a.txt [root@PC1 test]# cat a.txt ## 测试数据 a b c d x x k a d k k [root@PC1 test]# awk '{print gsub("k", "&")}' a.txt ## 统计每一行的k
阅读全文
摘要:001、 [root@PC1 test]# ls [root@PC1 test]# touch test{1..12} ## 创建测试数据 [root@PC1 test]# ls test1 test10 test11 test12 test2 test3 test4 test5 test6 tes
阅读全文
摘要:001、 [root@PC1 test4]# ls a.txt coordinate.txt [root@PC1 test4]# cat a.txt ## 测试数据 dd ff sd 1 ss aa ee 2 xx vv zz 3 ss ww rr 4 aa ff jj 5 nn mm kk 6 s
阅读全文
摘要:001、 [root@PC1 test]# ls coordinate.txt [root@PC1 test]# cat coordinate.txt ## 测试数据 3 MMM 5 GGG 8 QQQ [root@PC1 test]# awk '{if(NR == 1) {print $1 -1,
阅读全文
摘要:001、 sed 实现 [root@PC1 test4]# ls a.txt coordinate.txt [root@PC1 test4]# cat a.txt ## 测试数据 dd ff sd 1 ss aa ee 2 xx vv zz 3 ss ww rr 4 aa ff jj 5 nn mm
阅读全文
摘要:001、 [liujiaxin01@PC1 test]$ ls a.txt [liujiaxin01@PC1 test]$ cat a.txt ## 测试数据 ## xxx yy ## ddd ss ## kkk qqq ## mm nn 1 a A 7 2 b B 6 3 c C 5 4 d D
阅读全文
摘要:001、 [liujiaxin01@PC1 test]$ ls a.txt [liujiaxin01@PC1 test]$ cat a.txt ## xxx yy ## ddd ss ## kkk qqq ## mm nn 1 a A 7 2 b B 6 3 c C 5 4 d D 4 [liuji
阅读全文
摘要:001、 [liujiaxin01@PC1 test]$ ls a.txt [liujiaxin01@PC1 test]$ cat a.txt ## 测试数据 1 a A 7 2 b B 6 3 c C 5 4 d D 4 5 e E 3 6 f F 2 7 g G 1 [liujiaxin01@P
阅读全文
摘要:001、 [liujiaxin01@PC1 test]$ ls a.txt b.txt [liujiaxin01@PC1 test]$ echo {a..e} ## 输出a-e的字母序列 a b c d e [liujiaxin01@PC1 test]$ echo {a..e} | tr " " "
阅读全文
摘要:001、 [root@pc1 test]# ls [root@pc1 test]# var=mnopqrst ## 测试变量 [root@pc1 test]# echo $var ## 打印出该变量 mnopqrst [root@pc1 test]# echo ${var%qrst} ## 利用{}
阅读全文
摘要:001、 [root@pc1 test3]# ls a.txt [root@pc1 test3]# cat a.txt ## 测试数据 a b c a b c a b c [root@pc1 test3]# sed '1,6 /a/d' a.txt ## 删除1-6行中,匹配a的行, 发现报错 se
阅读全文
摘要:001、 [root@pc1 test1]# start=$(date +%s) ## 记录程序的开始时间 [root@pc1 test1]# echo $start 1671529118 [root@pc1 test1]# end=$(date +%s) ## 记录程序的结束时间 [root@pc
阅读全文
摘要:001、查找在过去五分钟内修改过的文件 find ./ -mmin -5 002、查找在过去10分钟内修改过的文件 find ./ -mmin -10 003、查找在过去一天内修改过的文件 find ./ -mtime -1 004、查找在过去10天内修改过的文件 find ./ -mtime -1
阅读全文
摘要:001、 [root@PC1 test]# ls a.txt [root@PC1 test]# cat a.txt ## 测试数据 7 yy 2 gg 4 mm 6 kk 5 mm 3 aa 9 xx 1 uu 8 oo [root@PC1 test]# cp a.txt a.txt_bak ##
阅读全文
摘要: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]# head -n -3 a.txt ## 删除最后3行 1 2 3 4 5 6 7 002、 [root@PC
阅读全文
摘要:001、cat + wc -l [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 | wc -l ## 输出文件的行数 10 002
阅读全文
摘要:001、 [root@PC1 test]# ls [root@PC1 test]# mkdir test1 test2 ## 测试文件夹 [root@PC1 test]# echo "xxx" > test2/a.txt [root@PC1 test]# ls test1 test2 [root@P
阅读全文

浙公网安备 33010602011771号