
linux命令--文本处理
文章平均质量分 86
常见的linux文本处理命令介绍
qiushye
这个作者很懒,什么都没留下…
展开
-
数据流处理命令awk
awk '{print $2}' [file] awk '/something/ {print $2}' [file] awk 'NR%3==1' [file]原创 2020-06-08 12:32:32 · 400 阅读 · 0 评论 -
文本处理工具命令xargs, sort, uniq, tr, cut, paste, wc等
1. 计数命令wcwc -l [file]: 输出文件[file]的行数 wc -c[file]: 输出文件[file]的byte(字节)数 wc -m[file]: 输出文件[file]的字符数, 如果文本都是单字符,则结果等同于wc -c [file] wc -w [file]:输出文件[file]的单词数➜ linux_commands cat test1hello ...原创 2020-05-22 12:39:15 · 580 阅读 · 0 评论 -
文本替换命令sed (mac环境)
➜ linux_commands cat hello.txthello worldhello boysshe is saying hellohello helloHELLO everyonesed (-l) 's/old_text/new_text/(g)' [file]➜ linux_commands sed -l 's/hello/hi/' hello.txthi w...原创 2020-04-30 12:27:52 · 1616 阅读 · 0 评论 -
打印命令echo
echo [text]: 打印文本内容, 如果文本内容带$符号,则表示打印对应的环境变量; 文本中支持转义字符,但一定要用引号包住➜ ~ echo "Hello world"Hello world➜ ~ echo $path/usr/local/opt/node@8/bin /Library/Frameworks/Python.framework/Versions/3.6/bin /...原创 2020-04-13 13:31:26 · 1096 阅读 · 0 评论 -
查找文本内容命令 grep
grep算是一个十分常用的linux命令了,用于查找文本,是加强版的ctrl+F,下面介绍一些常用的命令参数。1. 显示所在行数、文件名和最大匹配个数grep -n -H -m2. 文件及目录查找限制grep -f -R3. 多条件查找grep -v -egrep * | grep *...原创 2020-03-09 22:36:41 · 2245 阅读 · 0 评论