grep print only matched
you can use the -o
flag to only print matched value. Example
$ echo "Hello fellow unix fan" | grep --color -o nix
nix
$ echo "Hello fellow unix fan" | grep --color -o nux
$ echo $?
1
Last updated
Was this helpful?
you can use the -o
flag to only print matched value. Example
$ echo "Hello fellow unix fan" | grep --color -o nix
nix
$ echo "Hello fellow unix fan" | grep --color -o nux
$ echo $?
1
Last updated
Was this helpful?