Linux: grep多个关键字“与”和“或”

简介: Linux: grep多个关键字“与”和“或”时间 2014-05-15 01:31:47 Just Code http://www.tuicool.com/articles/6VJzI3v原文 http://justcoding.

Linux: grep多个关键字“与”和“或”
时间 2014-05-15 01:31:47 Just Code http://www.tuicool.com/articles/6VJzI3v
原文 http://justcoding.iteye.com/blog/2066598
主题 Linux命令

1、或操作

grep -E '123|abc' filename // 找出文件(filename)中包含123或者包含abc的行
egrep '123|abc' filename // 用egrep同样可以实现
awk '/123|abc/' filename // awk 的实现方式

2、与操作

grep pattern1 files | grep pattern2 //显示既匹配 pattern1 又匹配 pattern2 的行。

3、其他操作

grep -i pattern files //不区分大小写地搜索。默认情况区分大小写,
grep -l pattern files //只列出匹配的文件名,
grep -L pattern files //列出不匹配的文件名,
grep -w pattern files //只匹配整个单词,而不是字符串的一部分(如匹配‘magic’,而不是‘magical’),
grep -C number pattern files //匹配的上下文分别显示[number]行,

curl -o /dev/null -s -w "DNS解析时间: %{time_namelookup} n连接时间,从开始到建立TCP连接完成所用时间,包括前边DNS解析时间: %{time_connect}n连接建立完成时间:%{time_appconnect}n从开始到准备传输的时间: %{time_pretransfer}n开始传输时间: %{time_starttransfer}n总时间,按秒计: %{time_total}n" "https://api.weixin.qq.com"

ping IP地址或主机名 [-t] [-a] [-n count] [-l size]

curl 'http://umc.danuoyi.alicdn.com/multi_dns_resolve?client_ip=182.92.253.16' -d 'd.tv.taobao.com'

http:https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Status/502

工信部备案查询:http://www.beian.miit.gov.cn/publish/query/indexFirst.action

ip地址查询:http://www.chacuo.net/

charles 工具

相关文章
|
3月前
|
Linux
认识Linux指令之 “find grep” 命令
认识Linux指令之 “find grep” 命令
认识Linux指令之 “find grep” 命令
|
4月前
|
Linux
【linux】find、xargs、grep 联合查找文件内容
【linux】find、xargs、grep 联合查找文件内容
90 1
|
5月前
|
Linux 测试技术
软件测试/测试开发|一文详解Linux grep命令
软件测试/测试开发|一文详解Linux grep命令
59 1
|
5月前
|
SQL Linux 应用服务中间件
Linux - 管道(|)和grep 命令
Linux - 管道(|)和grep 命令
60 0
|
5月前
|
Linux Go 数据安全/隐私保护
linux常用命令手册 用户管理useradd 文件权限管理chmod 搜索管理find grep
linux常用命令手册 用户管理useradd 文件权限管理chmod 搜索管理find grep
67 2
|
2月前
|
存储 监控 Linux
性能工具之linux三剑客awk、grep、sed详解
Linux 三剑客 awk,sed和grep 在性能领域广泛用于性能建模、性能监控及性能分析等方面,也是各大互联网公司测试岗高频面试题,中高端测试人员必备技能之一。
59 1
性能工具之linux三剑客awk、grep、sed详解
|
15天前
|
Linux 数据库 开发者
【专栏】在Linux系统管理中,熟练使用命令行工具查找文件至关重要:如何按名称和 Grep 内容查找文件?
【4月更文挑战第28天】在Linux系统管理中,熟练使用命令行工具查找文件至关重要。本文介绍了如何使用`find`和`locate`按名称查找文件,以及结合`grep`按内容搜索。`find`能基于多种属性搜索,包括文件系统层次,而`locate`依赖索引数据库,速度更快。`grep`则用于在文件中搜索特定文本,支持正则表达式和多种选项。通过组合`find`/`locate`和`grep`,可实现更复杂的搜索任务,提升工作效率。
|
1月前
|
Linux
Linux 指令|date|cal|find|grep|热键
Linux 指令|date|cal|find|grep|热键
|
5月前
|
Linux Shell 开发工具
Linux tail & cat & grep 命令详解
Linux tail & cat & grep 命令详解
235 0
|
2月前
|
算法 Shell Linux
【Shell 命令集合 文档编辑】Linux 文本搜索工具 grep命令使用指南
【Shell 命令集合 文档编辑】Linux 文本搜索工具 grep命令使用指南
32 4