随笔分类 - language:Shell
摘要:alias myuniq="awk 'BEGIN{a[\"\"]=1}{if(!($0 in a)){print $0;a[$0]=1}}'" awk 'BEGIN{a[""]=1}{if(!(0 in a)){print0 in a)){print0;a[$0]=1}}'
阅读全文
摘要:https://blog.csdn.net/weixin_34032792/article/details/86010299 文件内容如下: more eng.txt chi.txt :::::::::::::: eng.txt :::::::::::::: semicolon comma deli
阅读全文
摘要:cat result.tmp.case_t |awk -F'\t' '((3==2)||(3==3)) && ($4 < 0.4) {print}' 按 '\t'分开列,第三列为2/3,第四列 < 0.4的数据输出
阅读全文
摘要:import sys for line in sys.stdin: line = line.strip('\n\r').split('\t') print("{0}\t{1}\1{2}\1{3}\1{4}\t{5}".format(line[0], line[2], line[3], line[4]
阅读全文
摘要:1 语法 https://www.runoob.com/linux/linux-comm-sed.html Linux sed 命令是利用脚本来处理文本文件。 sed 可依照脚本的指令来处理、编辑文本文件。 Sed 主要用来自动编辑一个或多个文件、简化对文件的反复操作、编写转换程序等。 1. 1 语
阅读全文
摘要:shell找出出现在A文件中,但是不在B文件中的行 cat A B B |sort |uniq -u > output.txt
阅读全文
摘要:1. cut cut的工作就是“剪”,具体的说就是在文件中负责 剪贴数据 用的。 cut命令从文件的每一行剪贴字节、字符 和 字段,并将这些字节、字符和字段输出。 1.1 基本用法 cut [选项参数] filename 说明:默认分隔符是制表符 1.2 选项参数说明 1.3 案例 2. sed 简
阅读全文
摘要:shell脚本还是很方便的....几百个音频, 一会就处理好了 实习生, 只能干干打杂的活...有点心累........诶, 心累
阅读全文
摘要:194. Transpose File Given a text file file.txt, transpose its content. You may assume that each row has the same number of columns and each field is s
阅读全文
摘要:193. Valid Phone Numbers 193. Valid Phone Numbers Given a text file file.txt that contains list of phone numbers (one per line), write a one liner bas
阅读全文
摘要:192. Word Frequency Write a bash script to calculate the frequency of each word in a text file words.txt. For simplicity sake, you may assume: words.t
阅读全文
摘要:sudo crontab -e
阅读全文
摘要:1. {print} coins.txt 1.1 {print $x}: 打印第x列 1.2 用制表键对齐 1.3 打印行号 (NR) 1.4 打印列号 (NF) 1.5 查找功能(某行数据) 1.6 自定义分隔符 输入分隔符:FS 输出分隔符:OFS 1.7 打印多文件 1.8 某列不想显示 2.
阅读全文
摘要:${}: 数据“内容”删除,替换;{}: 列表 1. 条件测试: test =~:正则匹配 2. if/then/elif/else/fi 3. case/esac 4. for/do/done 5. while/do/done 采用 i++ 6. break和continue 7. tee 功能:
阅读全文
摘要:1. 自定义变量(仅在当前shell生效) 1.1 定义变量 1.2 输入变量 1.3 位置变量 (1,2, 3...{10}....) 1.4 预定义变量 ( $0,$∗,$@,$#,$$,$!,$? ) 1.5 综合 2. 环境变量(在当前shel
阅读全文
摘要:!:显示上一条命令最后一个参数?: 上个命令的退出状态,或函数的返回值。 alias xxx="命令":给命令取别名 xxx 通过 vim ~/.bashrc 里编辑,可以来修改别名。 <, <<:重定向输出 、>, >>:重定向到文件 管道:| 命令排序 shell通配符 子shell:重新
阅读全文