ILD

grep只打印匹配的部分
作者:Yuan Jianpeng 邮箱:yuanjp89@163.com
发布时间:2019-4-19 站点:Inside Linux Development
使用-o选项即可。

-o, -only-matching:只打印匹配行中,匹配的部分。

-h, -no-filename: 抑制输出行中的前缀文件名。


参考:

https://bytefreaks.net/gnulinux/bash/grep-print-only-the-words-of-the-line-that-matched-the-regular-expression-one-per-line


Copyright © linuxdev.cc 2017-2024. Some Rights Reserved.