4 ms·
This is probably going on longer than it merits, but... Those aren't really good comparisons. Perhaps you have a different version of grep than I do, but my g
by 1amzave 17y ago
This is probably going on longer than it merits, but...
Those aren't really good comparisons.
Perhaps you have a different version of grep than I do, but my grep only prints filenames when more than one file has been specified for searching (in which case showing which file the match is from is necessary, I'd say), and certainly doesn't print line numbers if I don't give it '-n':
[me@host: ~]% grep PATH /etc/bashrc
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
PATH=$PATH:$1
PATH=$1:$PATH
[me@host: ~]% grep PATH /etc/bashrc /etc/profile
/etc/bashrc: if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
/etc/bashrc: PATH=$PATH:$1
/etc/bashrc: PATH=$1:$PATH
/etc/profile: if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
/etc/profile: PATH=$PATH:$1
/etc/profile: PATH=$1:$PATH
/etc/profile:export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE
/etc/profile:export PATH
[me@host: ~]% grep -V
grep (GNU grep) 2.5.1
As for du...well, frankly I'd prefer if du's output were less verbose -- a default more like 'du --max-depth=1' would be more to my liking. Compare to 'ls' vs. 'ls -R' (though I realize du does need to operate recursively regardless of whether it prints a line for everything it finds, so perhaps that's not an ideal comparison).
But the main difference here is the nature of what they're printing. In both of the above cases, the extra output text is still much more immediately relevant to the program's real task than what curl prints to stderr. For a more direct analogy, it would be like grep printing to stderr '50MB searched, 974MB remaining...' as it searches through a 1GB file.