网站首页 > 技术文章 正文
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
- 最近发表
- 标签列表
-
- cmd/c (90)
- c++中::是什么意思 (84)
- 标签用于 (71)
- 主键只能有一个吗 (77)
- c#console.writeline不显示 (95)
- pythoncase语句 (88)
- es6includes (74)
- sqlset (76)
- apt-getinstall-y (100)
- node_modules怎么生成 (87)
- chromepost (71)
- flexdirection (73)
- c++int转char (80)
- mysqlany_value (79)
- static函数和普通函数 (84)
- el-date-picker开始日期早于结束日期 (76)
- js判断是否是json字符串 (75)
- c语言min函数头文件 (77)
- asynccallback (71)
- localstorage.removeitem (74)
- vector线程安全吗 (70)
- java (73)
- js数组插入 (83)
- mac安装java (72)
- 无效的列索引 (74)