网站首页 > 技术文章 正文
1 grep的常用用法
- grep [参数]
-i 匹配忽略大小写
-c 只输出匹配的行数
-n 显示匹配的行号
-w 完全匹配
-r 递归的查询 -v 是不包含某个字串
root@wadequ-ThinkPad-L13:~# cat goinstall.sh //源文件内容
go install github.com/ramya-rao-a/go-outline
go install github.com/acroca/go-symbols
go install github.com/mdempsky/gocode
go install github.com/rogpeppe/godef
go install github.com/zmb3/gogetdoc
go install github.com/fatih/gomodifytags
go install sourcegraph.com/sqs/goreturns
go install github.com/cweill/gotests/...
go install github.com/josharian/impl
go install github.com/haya14busa/goplay/cmd/goplay
go install github.com/uudashr/gopkgs/cmd/gopkgs
go install github.com/davidrjenni/reftools/cmd/fillstruct
go install github.com/alecthomas/gometalinter
$GOPATH/bin/gometalinter --install
go install golang.org/x/tools/cmd/godoc
go install golang.org/x/lint/golint
go install golang.org/x/tools/cmd/gorename
go install golang.org/x/tools/cmd/goimports
go install golang.org/x/tools/cmd/guru
root@wadequ-ThinkPad-L13:~# cat goinstall.sh|grep -c cweill //显示匹配的行的个数
1
root@wadequ-ThinkPad-L13:~# grep -w alecthomas goinstall.sh //完全匹配
go install github.com/alecthomas/gometalinter
root@wadequ-ThinkPad-L13:~# grep -n alecthomas goinstall.sh //匹配且显示行号
13:go install github.com/alecthomas/gometalinter
oot@wadequ-ThinkPad-L13:/opt/go/velero/hack# grep -r velero ./ //递归的查询且显示文件名称
./changelog-check.sh: echo "PR ${pr_number} is missing a changelog. Please refer https://velero.io/docs/main/code-standards/#adding-a-changelog and add a changelog."
//当我们查找日志时需要显示上面或者下面几行可以使用-C
root@wadequ-ThinkPad-L13:/var/log# tail -fn 500 boot.log |grep -C 5 Failed
Starting senseshield...
Starting Unbound DNS server...
Starting containerd container runtime...
Starting Permit User Sessions...
Starting OpenBSD Secure Shell server...
[FAILED] Failed to start Teredo IPv6 tunneling.
See 'systemctl status miredo.service' for details.
[ OK ] Started OpenVPN service.
[ OK ] Started Permit User Sessions.
[ OK ] Started Modem Manager.
Starting GNOME Display Manager...
猜你喜欢
- 2024-09-10 oracle实用sql分享:杀进程、长时间操作等等
- 2024-09-10 走在前沿的弄潮儿,怎能不会Git的那些奇技淫巧
- 2024-09-10 TCP“三次握手,四次挥手”你真的懂吗?
- 2024-09-10 制作 deb 软件包(如何制作deb包)
- 2024-09-10 详解虚拟化之KVM概念、架构、功能、常用工具及部署
- 2024-09-10 Linux find命令一定要知道这些(linux find命令的使用)
- 2024-09-10 inux 文本处理三剑客--grep/sed/awk
- 2024-09-10 db2入门必看命令清单--日常运维必需
- 2024-09-10 浅谈Linux中的&&和ll(linux中atime)
- 2024-09-10 浅谈Linux中的&&和ll,补充&和l
- 02-21走进git时代, 你该怎么玩?_gits
- 02-21GitHub是什么?它可不仅仅是云中的Git版本控制器
- 02-21Git常用操作总结_git基本用法
- 02-21为什么互联网巨头使用Git而放弃SVN?(含核心命令与原理)
- 02-21Git 高级用法,喜欢就拿去用_git基本用法
- 02-21Git常用命令和Git团队使用规范指南
- 02-21总结几个常用的Git命令的使用方法
- 02-21Git工作原理和常用指令_git原理详解
- 最近发表
- 标签列表
-
- cmd/c (57)
- c++中::是什么意思 (57)
- sqlset (59)
- ps可以打开pdf格式吗 (58)
- phprequire_once (61)
- localstorage.removeitem (74)
- routermode (59)
- vector线程安全吗 (70)
- & (66)
- java (73)
- org.redisson (64)
- log.warn (60)
- cannotinstantiatethetype (62)
- js数组插入 (83)
- resttemplateokhttp (59)
- gormwherein (64)
- linux删除一个文件夹 (65)
- mac安装java (72)
- reader.onload (61)
- outofmemoryerror是什么意思 (64)
- flask文件上传 (63)
- eacces (67)
- 查看mysql是否启动 (70)
- java是值传递还是引用传递 (58)
- 无效的列索引 (74)