随笔分类 -  [30] Shell

摘要:依据几列的值删除重复行输入1.txta 1 1a 1 2a b 3a c 4a c 5a c 6a d 7a d 8a e 9a f 10 a f 11 输出2.txta b 3a e 9先把1.txt按照指定的几列(第1,2列)排序sort -k1,1 -k2,2 1.txt > 3.txtawk 阅读全文
posted @ 2021-08-23 21:11 emanlee 阅读(206) 评论(0) 推荐(0) 编辑
摘要:# cat > test.txt123456# more test.txt123456# xargs -l2 < test.txt | more1 23 45 6 阅读全文
posted @ 2021-05-13 19:50 emanlee 阅读(1710) 评论(0) 推荐(0) 编辑
摘要:例如:a="033" 1,用a2let(())letnum=033;echonum; 3,双括号运算符: a=((1+2));echoa; 等同于: a=`expr 1 + 2` REF https://blog.csdn.net/longshenl 阅读全文
posted @ 2021-04-28 21:56 emanlee 阅读(14600) 评论(0) 推荐(0) 编辑
摘要:split -l 200 all_prefetch_cmd.sh --additional-suffix=.sh -d -a 2 down_ 200 行 后缀 .sh down_00.sh down_01.sh down_02.sh 阅读全文
posted @ 2021-03-12 11:06 emanlee 阅读(442) 评论(0) 推荐(0) 编辑
摘要:用法:eval command-line原理:eval主要用在对参数的特殊处理上面的,一般的命令行,shell处理参数就只执行一遍,像转义和变量转变;但加上eval后就可以对参数多进行一遍处理;一个eval只能使shell对参数多一次处理,因此有几个eval就可以多加几次,即eval eval co 阅读全文
posted @ 2020-11-07 16:00 emanlee 阅读(1067) 评论(0) 推荐(0) 编辑
摘要:shell脚本运行时传入参数12 等,awk 也可以使用参数 12 等, 12 等会混淆。 解决方法: 脚本中awk用到自身的内置参数时,采用\进行转义 filename=1catfilename | awk -F"," '{ $1=""; print $0 }' REF 阅读全文
posted @ 2020-11-07 11:22 emanlee 阅读(1722) 评论(0) 推荐(0) 编辑
摘要:#!/bin/bash echo "Shell 传递参数实例!"; echo "执行的文件名:0";echo"1"; echo "第二个参数为:2";echo"3";echo "参数个数为:$#"; 阅读全文
posted @ 2020-11-07 11:16 emanlee 阅读(361) 评论(0) 推荐(0) 编辑
摘要:[aimin@localhost ~]ll/bin/shlrwxrwxrwx.1rootroot4Oct142017/bin/sh>bash[aimin@localhost ] ll /bin/bash-rwxr-xr-x. 1 root root 938768 Fe 阅读全文
posted @ 2020-10-31 18:44 emanlee 阅读(1034) 评论(0) 推荐(0) 编辑
摘要:[root@ibiomed ~]# cat > test.sh #!/bin/bash ## function: split file by specified line count ## parameter 1: file name to be splitted ## parameter 2: l 阅读全文
posted @ 2020-10-31 10:04 emanlee 阅读(1172) 评论(0) 推荐(0) 编辑
摘要:According to https://caseconverter.com/ “Upper Case” WHICH CONVERTS ALL THE LETTER INTO CAPITALS LIKE THIS. “Lower Case” which converts all the letter 阅读全文
posted @ 2020-07-30 16:21 emanlee 阅读(185) 评论(0) 推荐(0) 编辑
摘要:shell中大小写转换 shell中转换大小写转换 echo 'hello' | tr 'a-z' 'A-Z' echo 'HELLO' | tr 'A-Z' 'a-z' shell中大小写转换 shell中转换大小写转换 shell中大小写转换 shell中转换大小写转换 echo 'hello' 阅读全文
posted @ 2019-11-04 22:13 emanlee 阅读(4907) 评论(0) 推荐(0) 编辑
摘要:You can do this with find alone using the -exec action: {} will be expanded to the files found and + will enable us to read as many arguments as possi 阅读全文
posted @ 2019-03-08 09:27 emanlee 阅读(217) 评论(0) 推荐(0) 编辑
摘要:调试脚本检查脚本语法错误bash -n /path/to/some_script调试执行bash -x /path/to/some_scriptshell里的变量 本地变量:只对当前shell有效;作用范围可以是整个shell程序文件,包括脚本中的函数,对其他的shell无效。 环境变量:对当前sh 阅读全文
posted @ 2019-01-28 23:34 emanlee 阅读(436) 评论(0) 推荐(0) 编辑
摘要:ref https://blog.csdn.net/xiangxianghehe/article/details/78149094 一.安装 crontabs服务并设置开机自启: 二.设置用户自定义定时任务: 可以看到: 即: 每隔30分钟root执行一次updatedb命令: 每天早上5点定时重启 阅读全文
posted @ 2019-01-19 23:44 emanlee 阅读(11240) 评论(0) 推荐(0) 编辑
摘要:Linux tail command Updated: 05/21/2018 by Computer Hope About tail Syntax Examples ▸ Related commands ▸ Linux and Unix commands help Syntax Examples ▸ 阅读全文
posted @ 2018-07-22 23:22 emanlee 阅读(1240) 评论(0) 推荐(0) 编辑
摘要:REF: https://stackoverflow.com/questions/16391208/print-a-files-last-modified-date-in-bash 阅读全文
posted @ 2018-04-25 04:59 emanlee 阅读(203) 评论(0) 推荐(0) 编辑
摘要:1. nohup nohup 无疑是我们首先想到的办法。顾名思义,nohup 的用途就是让提交的命令忽略 hangup 信号。 nohup 的使用是十分方便的,只需在要处理的命令前加上 nohup 即可,标准输出和标准错误缺省会被重定向到 nohup.out 文件中。一般我们可在结尾加上"&"来将命 阅读全文
posted @ 2018-03-16 22:53 emanlee 阅读(8332) 评论(0) 推荐(0) 编辑
摘要:cat > temp004AA1abcAA2AA3abcAA4abcAA5AA6awk 'BEGIN {pre=0; str="";} { if(NR==1){ if(0 /AA/)pre=1;elsepre=0;str=0; } else { if($0 ~ /AA/) { 阅读全文
posted @ 2017-12-06 02:13 emanlee 阅读(218) 评论(0) 推荐(0) 编辑
摘要:cat > temp0015101269125 awk 'p{print $0-p}{p=$0}' temp00152-633-7 REF: https://www.unix.com/shell-programming-and-scripting/130727-how-subtract-adjace 阅读全文
posted @ 2017-12-06 01:32 emanlee 阅读(195) 评论(0) 推荐(0) 编辑
摘要:Liang always brings me interesting quiz questions. Here is one: If i have a table like below: chr1 113438 114495 1 chr1 114142 114143 chr1 113438 1144 阅读全文
posted @ 2017-12-05 23:40 emanlee 阅读(497) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示