随笔分类 - [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
阅读全文
摘要:# cat > test.txt123456# more test.txt123456# xargs -l2 < test.txt | more1 23 45 6
阅读全文
摘要: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
阅读全文
摘要:用法:eval command-line原理:eval主要用在对参数的特殊处理上面的,一般的命令行,shell处理参数就只执行一遍,像转义和变量转变;但加上eval后就可以对参数多进行一遍处理;一个eval只能使shell对参数多一次处理,因此有几个eval就可以多加几次,即eval eval co
阅读全文
摘要:shell脚本运行时传入参数2 等,awk 也可以使用参数 2 等, 2 等会混淆。 解决方法: 脚本中awk用到自身的内置参数时,采用\进行转义 filename=filename | awk -F"," '{ $1=""; print $0 }' REF
阅读全文
摘要:[aimin@localhost ~] ll /bin/bash-rwxr-xr-x. 1 root root 938768 Fe
阅读全文
摘要:[root@ibiomed ~]# cat > test.sh #!/bin/bash ## function: split file by specified line count ## parameter 1: file name to be splitted ## parameter 2: l
阅读全文
摘要:According to https://caseconverter.com/ “Upper Case” WHICH CONVERTS ALL THE LETTER INTO CAPITALS LIKE THIS. “Lower Case” which converts all the letter
阅读全文
摘要:shell中大小写转换 shell中转换大小写转换 echo 'hello' | tr 'a-z' 'A-Z' echo 'HELLO' | tr 'A-Z' 'a-z' shell中大小写转换 shell中转换大小写转换 shell中大小写转换 shell中转换大小写转换 echo 'hello'
阅读全文
摘要: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
阅读全文
摘要:调试脚本检查脚本语法错误bash -n /path/to/some_script调试执行bash -x /path/to/some_scriptshell里的变量 本地变量:只对当前shell有效;作用范围可以是整个shell程序文件,包括脚本中的函数,对其他的shell无效。 环境变量:对当前sh
阅读全文
摘要:ref https://blog.csdn.net/xiangxianghehe/article/details/78149094 一.安装 crontabs服务并设置开机自启: 二.设置用户自定义定时任务: 可以看到: 即: 每隔30分钟root执行一次updatedb命令: 每天早上5点定时重启
阅读全文
摘要:Linux tail command Updated: 05/21/2018 by Computer Hope About tail Syntax Examples ▸ Related commands ▸ Linux and Unix commands help Syntax Examples ▸
阅读全文
摘要:REF: https://stackoverflow.com/questions/16391208/print-a-files-last-modified-date-in-bash
阅读全文
摘要:1. nohup nohup 无疑是我们首先想到的办法。顾名思义,nohup 的用途就是让提交的命令忽略 hangup 信号。 nohup 的使用是十分方便的,只需在要处理的命令前加上 nohup 即可,标准输出和标准错误缺省会被重定向到 nohup.out 文件中。一般我们可在结尾加上"&"来将命
阅读全文
摘要:cat > temp004AA1abcAA2AA3abcAA4abcAA5AA6awk 'BEGIN {pre=0; str="";} { if(NR==1){ if(0; } else { if($0 ~ /AA/) {
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文