wiki/运维/操作系统/Linux/笔记/11.文本分析.md
2025-01-02 10:46:09 +08:00

24 lines
586 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

##### 1、wc文本数据统计
-l只统计行数
-w只统计单词数
##### 2、sort文本排序仅输出到STDOUT
-R随机排序
-n按数字大小整理
-h按人类可读排序
-u合并重复项
##### 3、uniq文本去重
-c显示每行重复次数
-d仅显示重复的行
-u仅显示不重复的行
范例:统计日志访问量最多的请求
```shell
cut -d" " access_log | sort | uniq -c | sort -nr | head -3
```
##### 4、cut按列抽取文本
-d指定分隔符
-c按字符分隔
-f取第几列1-6或135