# using grep 2.20 ...
# grep "[[:cntrl:]]" /proc/1/cmdline
Binary file /proc/1/cmdline matches
# using grep 3.3 or above 2.20 ...
# grep "[[:cntrl:]]" /proc/1/cmdline
... nothing returned
My best.,
Jeff
> This is documented behavior; the grep manual says that when grep is
reading a
binary file it "may treat non-text bytes as line terminators".
> You can use grep's -a (--text) option to if you want to match null bytes.
Paul,
Thanks for pointing this out. Didn't know that as it works on 2.20.
The
ert wrote:
> On 7/28/19 3:04 AM, Jeff Chua wrote:
> > Then if it's binary file, grep should default to "-a"
>
> No, as that would mean the default output of grep would not be text, and
> this could mess up terminals etc. This is partly why -a has never been
> the d